[Tkinter-discuss] How to get DIB into Tkinter frame?

Reiner M. Stoss rstoss at online.de
Mon Sep 4 14:59:41 CEST 2006


> hDC is "handle to device context" in MS lingo.  I can't answer the use
> of DCs in Tkinter, but I'm now very interested in Fredrik's response
> having understood what you're doing after you second mail.  Wondering
> too if the win32 GetDCex call might be used...just not sure how that'd
> interface with tkinter.

Thanks, Bobby. Someone mentioned that it might work like this:

class ImageShower(Tkinter.Frame):
	def __init__(self, dib):
		Tkinter.Frame.__init__(self)
		self.dib = dib
		self.bind("<Map>", self.redraw)
	
	def redraw(self, ev=None):
		self.dib.expose(ImageWin.HWND(self.winfo_id()))

But now how to make the connection between
PaintPicture(DeviceContext) and ImageShower()?
Something like this doesn't work:
m.PaintPicture(ImageShower(frame1))

It returns:
Traceback (most recent call last):
  File "L:\pin.py", line 100, in ?
    m.PaintPicture(ImageShower(frame1))
  File "<COMObject NewPlateDIB>", line 2, in PaintPicture
AttributeError: ImageShower instance has no attribute '__int__'

Reiner




More information about the Tkinter-discuss mailing list