Next / Previous / Contents / TCC Help System / NM Tech homepage

17.3. ModelSelector.__init__(): Constructor

The constructor first calls the parent class constructor, which makes self a Frame.

huey
# - - -   M o d e l S e l e c t o r . _ _ i n i t _ _

    def __init__ ( self, parent, callback ):
        """Constructor for the ModelSelector compound widget.
        """

        #-- 1 --
        # [ parent  :=  parent with a new Frame widget added but
        #               not gridded
        #   self  :=  that new Frame widget ]
        Frame.__init__ ( self, parent, relief=SUNKEN, bd=4 )

Next we store a reference to the callback function, and create the list that will contain the radiobuttons, and then create and initialize their associated control variable. Finally, we create all the widgets—see Section 17.4, “ModelSelector.__createWidgets().

huey
        #-- 2 --
        self.__callback  =  None
        self.__radioList  =  []
        self.__radioVar  =  IntVar()
        self.__radioVar.set(0)

        #-- 3 --
        # [ self  :=  self with all internal widgets created and
        #             gridded ]
        self.__createWidgets()

        #-- 4 --
        self.__callback  =  callback