Next / Previous / Contents / Shipman's homepage

7. PageTurner.__init__(): The constructor

The constructor has four general duties: call the parent class constructor; process the arguments; set up invariants on the attributes; and create the widgets. The latter is delegated to the .__createWidgets() method.

pageturner.py
# - - -   P a g e T u r n e r . _ _ i n i t _ _   - - -

    def __init__ ( self, master=None, size=None ):
        """Constructor for the PageTurner widget."""

        #-- 1 --
        # [ master  :=  master with a new Frame added but not gridded
        #   self    :=  that new Frame ]
        Frame.__init__ ( self, master )

        #-- 2 --
        self.__size  =  size

        #-- 3 --
        self.__pageList  =  []
        self.__pageNo    =  0

        #-- 4 --
        # [ self  :=  self with all widgets created ]
        self.__createWidgets()