Page 273 -
P. 273

beauty without brains


          The GUI works, but doesn’t do anything




                                                   Nice interface, but it doesn‛t work.
                                                   When I click on a button, nothing
                                                   happens... I don‛t hear anything. What
                                                   happened to my cool sound effects?




                                                      The graphical user interface might
                                                      be ready, but the program is not
                                                      complete.




























            Q:   So all tkinter gives me is the ability to draw the GUI?  Q:  That’s all that left, right, top, and bottom

                                                            stuff, isn’t it?
            A: Well, yes, but there’s quite a lot of functionality wrapped up in
            that small number of lines of tkinter code.     A: Yes, as well as the padx and pady parameters. They
            Q:   That pack() method looks a little weird... how does it   help with widget positioning, too, by putting additonal space (or
                                                            padding) around your buttons.
            know where to put things?                       Q:   OK, I get that, but how come nothing happens when I

            A: The pack() method adopts a best-guess approach when   click on my buttons?
            it comes to packing your GUI widgets within your GUI application
            window. This usually works out, and when it doesn’t, pack()’s   A: Ah, funny you should ask that...
            parameters give you some control over the situation.

           238    Chapter 7
   268   269   270   271   272   273   274   275   276   277   278