canvas in Pmw

John Grayson johngrayson at home.com
Thu May 11 21:52:29 CEST 2000


In article <391B0669.578876FF at mitre.org>,
  Mike Wingfield <psl at mitre.org> wrote:
>
> I am trying to write an image to a canvas in an application using Pmw.
> When I do this I get the following error message:
>
> Traceback (innermost last):
>   File "OutWin.py", line 24, in ?
>     map.create_image(200,200, image=img, anchor = CENTER)
>   File "C:\Program Files\Python\Lib\lib-tk\Tkinter.py", line 1223, in
> _create_image
>     return self.create('image', args, kw)
>   File "C:\Program Files\Python\Lib\lib-tk\Tkinter.py", line 1216, in
> _create
>     (self.w, 'create', itemType)
> TclError: image "8827440" doesn't exist
>
> If I remove Pmw parts of the code it seems to work ok.  What do I need
> to do to get the canvas to run within a Frame in an application using
> Pmw?
>

To get a good response from this group you really need to provide
at least a fragment of your code -- otherwise you'll tend to get
responses such as:

      "Yep, it doesn't work -- that's an error message"      :(

This fragment works:

import Pmw
root = Tk()
Pmw.initialise()

sc = Pmw.ScrolledCanvas(root, borderframe=1, labelpos=N,
                        label_text='ScrolledCanvas', usehullsize=1,
                        hull_width=400,	hull_height=300)
img = PhotoImage(file='img52.gif')
sc.create_image(145,280, image=img, anchor=CENTER)
sc.pack()
sc.resizescrollregion()

root.mainloop()



Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list