Yellos
Yellos

Reputation: 1657

_tkinter.TclError: format error in bitmap data

This line:

bitmap = Tkinter.BitmapImage(file="logo.bmp")

Gives me this error:

  File "gpm.py", line 314, in <module>
    bitmap = Tkinter.BitmapImage(file=LOGO_PATH)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 3365, in __init__
    Image.__init__(self, 'bitmap', name, cnf, master, **kw)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 3262, in __init__
    self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: format error in bitmap data

I have no clue how to fix this. It doesn't work with any .bmp file.

Upvotes: 1

Views: 1226

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 386030

The tkinter BitmapImage takes an X11 bitmap file as an argument. This is not the same format as a windows .bmp file. Make sure you're using the correct type of file. Typically, the suffix of an X11 bitmap file is .xbm.

Upvotes: 3

Related Questions