Bitmaps in Tkinter

Hans Kristian Ruud hans.kristian.ruud at inenco.no
Wed Aug 9 09:21:07 EDT 2000


I am teaching myself Tkinter programming from the book
'Python and Tkinter programming' by John  E. Grayson.

I have a problem with bitmaps: e.g.when I try to run the example on p.
59:

from Tkinter import *
import Pmw

bitmap_path = 'D:\\usr\\X11R6.4\\include\\X11\\bitmaps\\'
root = Tk()
Pmw.initialise()

balloon = Pmw.Balloon(root)
menuBar = Pmw.MenuBar(root, hull_relief=RAISED, hull_borderwidth=1,
  balloon=balloon)
menuBar.pack(fill=X)
menuBar.addmenu('Buttons', 'Simple Commands')
menuBar.addmenuitem('Buttons', 'command', 'Close this window',
  font=('StingerLight', 14), label='Close')
menuBar.addmenuitem('Buttons', 'command', bitmap="@bitmaps\\RotateLeft",

  foreground='Yellow')
menuBar.addmenuitem('Buttons', 'separator')
menuBar.addmenuitem('Buttons', 'command',
  'Exit the application', label='Exit')

menuBar.addmenu('Cascade', 'Cascading Menus')
menuBar.addmenu('Checkbutton', 'Checkbutton Menus')
menuBar.addmenu('Radiobutton', 'Radiobutton Menus')

root.mainloop()


I get this output:

D:\drsc\exercizes>MenuBar.py
Traceback (innermost last):
  File "D:\drsc\EXERCI~1\MenuBar.py", line 16, in ?
    foreground='Yellow')
  File "D:\program files\Python\Pmw\Pmw_0_8_4\lib\PmwMenuBar.py", line
171, in
addmenuitem
    apply(command, (), kw)
  File "D:\program files\Python\Lib\lib-tk\Tkinter.py", line 1517, in
add_command
    self.add('command', cnf or kw)
  File "D:\program files\Python\Lib\lib-tk\Tkinter.py", line 1510, in
add
    self.tk.call((self._w, 'add', itemType) +
TclError: error reading bitmap file "bitmaps\RotateLeft"


Any ideas?

- thanks in advance -
--
Hans Kristian Ruud
22 18 63 08 (jobb) 22 65 22 34 (hjemme) 952 33 224 (mob)
Wash daily from nosetip to tailtip, drink deeply but not to deep
remember the night is for hunting, forget not the day is for sleep





More information about the Python-list mailing list