Page 79 - Programming the Raspberry Pi Getting Started with Python
P. 79

The first step is to create a root Menu. This is the single object that will contain all the menus (File
          and Edit, in this case, along with all the menu options).

             To create the File menu, with its single option, Quit, we first create another instance of Menu and

          then add a command for Quit and finally add the File menu to the root Menu:





             The Edit menu is created in just the same way. To make the menus appear on the window, we have
          to use the following command:



          The Canvas
          In the next chapter, you’ll get a brief introduction to game programming using PyGame. This allows
          all sorts of nice graphical effects to be achieved. However, if you just need to create simple graphics,
          such as drawing shapes or plotting line graphs on the screen, you can use Tkinter’s Canvas interface
          instead (see Figure 7-12).
   74   75   76   77   78   79   80   81   82   83   84