Page 270 -
P. 270

building a graphical user interface


           tkinter is packed with options


           The pack() method lets you position the button in the application
           window. If you provide a value for the side parameter to pack(),
           you can control where in the window the button appears. Here are the
           legal values for side:                                                  The value of “side”
                                                                                   controls where the
                                                                                   button is packed.
                               pack(side = ‛left’)
                               Position the button on the left side of the window.

                               pack(side = ‛right’)
                               Position the button on the right side of the window.

                               pack(side = ‛top’)
                               Position the button at the top of the window.

                               pack(side = ‛bottom’)
                               Position the button at the bottom of the window.

           It is also possible to add some padding around buttons (to make them
           look nicer in your window):

                               pack(padx = 10, pady = 10)
                               Position the button with 10 pixels padding on all four sides.





                                                Based on what you now know about tkinter windows and
                                                buttons, write the code to display the GUI that you need for the
                                                TVN program:

























                                                                                       you are here 4    235
   265   266   267   268   269   270   271   272   273   274   275