Page 403 -
P. 403

necessary methods








                                                You needed to create some methods for the new SoundPanel()
                                                class. You were asked to identify which of the following behaviors you
                                                thought you needed to create methods for:
                                                   You’ve already created
                 Someone moves the volume slider.  event handlers that   Someone clicks the checkbox.
                                                   do something like this.

                 The computer starts up.                                You get to the end of the track.
                                        What do you need
                 Create the interface.  to do to create
                                        the interface?











            Q:   Why is there a method to create the widget?  Q:  So you can’t always see objects on the screen then?



            A: There isn’t a method to create the widget. But there is a   A: No, most objects run quietly in memory and they don’t have
            method to create the interface. That method will run immediately   any display at all.
            after the widget is created.                    Q:
            Q:   I don’t get it. What’s the difference between a widget    Is Python the only object oriented language?

            and an object?                                 A: Lots of languages—such as Java, C#, and Ruby—use
                                                            objects to handle complexity.
            A: A widget is a particular type of object. It’s an object that you
            can add to a graphical user interface.          Q:   So learning object orientation is a good way of getting
            Q:   So there are some objects that are not widgets?  into other languages?

                                                           A: Yes, understanding object orientation gives you a insight into
            A: Absolutely. Most objects are used behind the scenes in   how other languages think.
            programs. All of the numbers and strings you’ve used so far have
            actually been objects.









           368    Chapter 10
   398   399   400   401   402   403   404   405   406   407   408