Why in the world does Python's Tkinter break using canvas.create_image? -


I have a dragon GUI app in the works, which I want to use on both Windows and Mac. Documentation is not the largest on Tkinter, and google-fu has failed me.

In short, I am:

  c = canvas (master = frame, width = settings .window_SIZE [0], height = settings.window_SIZE [1] , Background = settings.CANVAS_COLOUR) file = photo image (file = os.path.join ('path', 'to', 'gif')) C.create_bitmap (position, image = file) c.pack () root.mainloop ()  

If I comment on the create_bitmap line, the app tends to fix, if I comment it back, I get the following error:

< Code> _tkinter.TclError: unknown option "-image" < / Code>

Who is weird, the tectorter is okay, according to the dragon tests (i.e., the importer, the connector, and the TE). I have imagined since installing PIL against my Windows setup (XP SP3, Python 2.6) that it is lifting heavy load at lower levels. It does not seem that; I still got the first error.

The complete stacktrace, except for the pre-pasted code, is:

  file "C: \ Python26 \ lib \ lib-Tk \ Tkinter.py", In line 2153, create_btmap returns the self._create ('bitmap', args, kw) file "C: \ Python26 \ lib \ lib-tk \ Tkinter.py", in line 2147, _create * (anybody capable of putting any light Also? 

Two twenty types of graphics, Bitmap and image are images that come in two flavors, bitmaps, and photos, images of bitmaps and type bitmaps There is no such thing, which leads to confusion in the docs. Photo creates an image of the image type type, and the canvas requires an image object, so the solution is, as you have already concluded, create_image To use.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -