Error in trying to locate bitmaps files

Robert Cragie rcc at nospamthanks_jennic.com
Wed May 3 11:18:44 EDT 2000


The syntax of 'bitmap=@<filename>' goes straight to Tk, therefore appending
to sys.path won't make any difference . A snippet from the Tk help file says
this:

<snippet>
@fileName

FileName must be the name of a file containing a bitmap description in the
standard X11 or X10 format
</snippet>

Unfortunately, that doesn't help me much either; maybe some other kind soul
can help.

If you specify the full path for the file it works, e.g. on my machine

Label(f2,bitmap='@C:\\Program
Files\\Python\\src\\Grayson\\examples\\chapter04\\bitmaps\\woman',text="My
second label in tk",relief=RAISED).pack(side=LEFT, padx=5)

works OK. That's why the example works - the pathname is valid relative to
where the application is run.

A word of warning - if you're trying to enter things interactively in IDLE,
you can get unstuck with Tkinter apps. as IDLE is written using Tkinter as
well. The most notable thing is NOT to call the mainloop() method in IDLE.
Also, I have found some problems with some of the examples if you are using
Python Megawidgets 0.8.3 - there are some subtle differences between 0.8 and
0.8.3.

Robert

Fanny Yeung <fannyy at idmail.com> wrote in message
news:e6RP4.21542$H7.1329941 at brie.direct.ca...
| Hi everyone,
|
| I am new in python and just bough "python and tkinter programming" BY John
| Grayson. As I go thru some example, I run into the following error when it
| try to create a label.
|
| >>> Label(f2,bitmap='@bitmaps/woman',text="My second label in
| tk",relief=RAISED).pack(side=LEFT, padx=5)
| Traceback (innermost last):
|   File "<pyshell#34>", line 1, in ?
|     Label(f2,bitmap='@bitmaps/woman',text="My second label in
| tk",relief=RAISED).pack(side=LEFT, padx=5)
|   File "E:\Program Files\Python\Lib\lib-tk\Tkinter.py", line 1410, in
| __init__
|     Widget.__init__(self, master, 'label', cnf, kw)
|   File "E:\Program Files\Python\Lib\lib-tk\Tkinter.py", line 1084, in
| __init__
|     self.tk.call(
| TclError: error reading bitmap file "bitmaps\woman"
|
| I have python 1.5 and Tcl 8 installed in my NT machine. I think is related
| to configuration but I just don't have any idea on how to trace this
| problem.
|
| Thanks in advance.
|
| Mak
|
|





More information about the Python-list mailing list