Page 418 -
P. 418

custom widgets and classes


                              Your Programming Toolbox


                               You’ve got Chapter 10 under your belt.
                                Let’s look back at what you’ve learned
                                in this chapter:                                                                CHAPTER 10






               Programming T ools
               * Local functions live inside other functions.

                * Object orientation is a way of using
                software objects to handle complexity.
                 * Classes are machines to create objects;
                 think of them like a “cookie cutter”.
                  * Classes have methods that define their


                   objects’ behavior.                       Python T ools
                   * Created objects are known as “instances”of


                    * An initializer tells an object what to do
                    some class.                            * Frame() - tkinter’s frames are widgets
                                                            that contain other widgets and help to keep
                                                           the widgets together (grouped).
                     once it’s been created.
                     * Some languages call initializers    * class - a keyword that introduces a new
                                                           class definition.
                     “constructors.”                       * __init__() - the name of the method
                      * Not all objects are GUI objects.   that is called automatically on object
                       * Widgets are a kind of object.     creation.



                                                          * self - methods have a special variable
                                                          called “self” that is set to the current
                                                          object.

                                                          * Adding “self.” to the start of a variable
                                                          means it belongs to the current object.









                                                                                      you are here 4    383
   413   414   415   416   417   418   419   420   421   422   423