Python Tkinter Newbie question

W

Wim Goffin

Hi,

I'm trying to get a bitmap onto a button, but I can't.
Can anyone tell me where to look for a solution?

The call I use is this one:
self.b = Button(toolbar, text="nieuw", bitmap="@/test.xbm", width=20, command=self.print_msg)

The message I get is this:
Traceback (most recent call last):
File "C:\Documents and Settings\Wim\Mijn documenten\Python\overhoor.py", line 143, in -toplevel-
app = App(root)
File "C:\Documents and Settings\Wim\Mijn documenten\Python\overhoor.py", line 71, in __init__
self.b = Button(toolbar, text="nieuw", bitmap="@/test.xbm", width=20, command=self.print_msg)
File "C:\Python24\lib\lib-tk\Tkinter.py", line 1939, in __init__
Widget.__init__(self, master, 'button', cnf, kw)
File "C:\Python24\lib\lib-tk\Tkinter.py", line 1868, in __init__
self.tk.call(
TclError: error reading bitmap file "\test.xbm"

This is hapening on a WindowsXP system.
It seems as though the file is not found. Because if specify the name of a non-existing file, then I get exactly the same error. What could I do to make sure first that Puthon does find the file?

Thanks in advance,
Wim Goffin
 
H

Harlin Seritt

You have:

="@/test.xbm"

take the '/' out or (if it is in a different dir which i think it is),
do

="/@test.xbm"

also... make sure your *.xbm is really a bitmap file (that would just
be another thing to check... not to say its not the proper format)...


Regards,

Harlin Seritt
 
H

Harlin Seritt

Try not to triple post if you can help it (I'll assume you accidentally
hit the SENT button three times <whistles>)

Regards,

Harlin Seritt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top