Page 271 -
P. 271

gooey display













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

                                       from tkinter import *


               Create the window as
               in the earlier example,   app = Tk()
               but change the window
               title and geometry      app.title(“TVN Game Show")
               values.                 app.geometry(‘300x100+200+100')


                  Create a button for
                  the “Correct" event.
                                       b1 = Button(app, text = “Correct!", width = 10)

               Pack one button         b1.pack(side = ‘left', padx = 10, pady = 10)
               on the left, the
               other on the right,
               and give them some      b2 = Button(app, text = “Wrong!", width = 10)
               padding.
             Create another button     b2.pack(side = ‘right', padx = 10, pady = 10)
             for the “Wrong" event.


                 Start the event loop.  app.mainloop()




















           236    Chapter 7
   266   267   268   269   270   271   272   273   274   275   276