Page 301 -
P. 301

interface created


                       Code Magnets Solution

                       You were to complete the code to create the interface. You were to
                       think carefully about the widgets you will need for each of the fields.




                                                        The “save_data()” code needs to
                           from tkinter import *       be inserted before the GUI code
                                                       so that the button can see it.
                           app = Tk()
                           app.title('Head-Ex Deliveries')
                           Label(app, text = "Depot:").pack()
                           depot = Entry(app)
                           depot.pack()
                             Label(app, text = "Description:")    .pack()


             Create two      description =     Entry(app)
             fields: one is
             an Entry field   description  .pack()
             and the other
             is a T ext field.                                                Don't forget to pack
                              Label(app, text = "Address:")    .pack()        those widgets.

                 Address      address =    Text(app)
                 is a larger
                 T ext field.
                              address   .pack()


                           Button(app, text = "Save", command = save_data).pack()

                             app.mainloop()


















           266    Chapter 8
   296   297   298   299   300   301   302   303   304   305   306