Re: Tkinter Bitmap Newbie question

From: Wim Goffin (wim.goffin_at_telenet.be)
Date: 03/14/05


Date: Mon, 14 Mar 2005 22:51:24 GMT

Thanks for all reactions. I can load the bitmap now thanks to your help.

But just to make sure I'm on the right track,
- Is XBM the best way to for bitmaps? The ones I saw so far are all black
and white. Do they also exist in color?
- Is XBM also the best format for glyphs on the Windows platform? Or would
'Images' of a different format be nicer?
- Does someone know of a nice downloadable collection of standard glyphs
(Bitmaps for Open file, New file, Save file, ...) with a free license?

Thanks again,

--
Wim
"Raseliarison nirinA" <nirina@mail.blueline.mg> schreef in bericht 
news:mailman.342.1110718966.1799.python-list@python.org...
> "Wim Goffin" wrote:
>
>>>> Hi,
>
> hello,
>
>>>> 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?
>
> well, you do make sure that the file exists in the right place.
>
> bitmap="@/test.xbm" means something like: look for a bitmap file
> named test.xbm at location "/" , that is, at the top level directory.
>
> bitmap="@c:/test.xbm" is equivalent.
>
> some solutions:
> 1) copy (or cut)  and paste the file test.xbm to c:/ and continue to
> use your code or,
> 2) if test.xbm is in the same directory as your code, you may write:
> bitmap="@test.xbm" or bitmap="@./test.xbm"
> where "./" means the current directory or,
> 3) you may write something like (one single string!):
> bitmap="@C:/Documents and Settings\Wim/Mijn
> documenten\Python/test.xbm"
>
> notice also that if the bitmap appears in your button,
> your text="nieuw" may not be visible.
>
>>>> Thanks in advance,
>>>> Wim Goffin
>
> hope this help.
>
> --
> nirinA
>
>
>
>
>
>
>
> 


Relevant Pages

  • tkinter canvas bitmaps w/ xbm formated string data?
    ... canvas....I don't have any trouble with loading/displaying xbm files, ... it's when I've pre-created the xbm as a string I get a 'can't find ... your bitmap error' ... <created my canvas and I draw other objects that are displayed ...
    (comp.lang.python)
  • Re: Tkinter Bitmap Newbie question
    ... "Wim Goffin" wrote: ... you may write something like (one single string!): ... notice also that if the bitmap appears in your button, ...
    (comp.lang.python)
  • Newbie question Tkinter bitmap
    ... I'm trying to get a bitmap onto a button, ... error reading bitmap file "\test.xbm" ... What could I do to make sure first that Puthon does find the file? ... Wim Goffin ...
    (comp.lang.python)
  • Python Tkinter Newbie question
    ... I'm trying to get a bitmap onto a button, ... error reading bitmap file "\test.xbm" ... What could I do to make sure first that Puthon does find the file? ... Wim Goffin ...
    (comp.lang.python)
  • Tkinter Bitmap Newbie question
    ... I'm trying to get a bitmap onto a button, ... error reading bitmap file "\test.xbm" ... What could I do to make sure first that Puthon does find the file? ... Wim Goffin ...
    (comp.lang.python)