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

Reiner M. Stoss rstoss at online.de
Fri Sep 1 11:30:49 CEST 2006

> From your code snippet I fail to see where you're defining "im".  I'm
> assuming the value of im is the same as your VB value "Picture1.hDC".
> Is that a constant from the PinPoint.Plate object?  If so, perhaps it's
> not defined.  From first glance the error looks valid.

Of course the error is valid, but how to avoid it? :-)
Yes, I have not defined "im". That's excatly the point.
I do not know how do define it.
Picture1 is a PictureBox in VB and the PaintPicture
method of PinPoint then sends the picture into this
But I need to do it in Python/Tkinter so how to tell
the PaintPicture to send the picture into a Tkinter frame?

Again the code in VB:
Private Sub Command1_Click() 

Set p = CreateObject("PinPoint.Plate") 
p.AttachFITS "M:\Images\LaSagra\20060828\012128+170000-sagra21-S001-R001.fts" 
Set m = p.NewPlateDIB() 
m.Create 1, 1, 1, 1 
m.Render 60000, 0 
m.PaintPicture Picture1.hDC 

End Sub 

And the not working code in Python:
p = win32com.client.dynamic.Dispatch('PinPoint.Plate') 
m = p.NewPlateDIB() 
m.Create(1, 1, 1, 1) 
m.Render(60000, 0) 
#Here some Tkinter lines like root = Tk() etc.
def expose(event): 
    dib = ImageWin.Dib(im) 

left_frame.bind("", expose) 

Traceback (most recent call last):
  File "L:\pin.py", line 91, in ?
NameError: name 'im' is not defined

I know how to send an image from a file to a Tkinter frame.
But in this case we talk about a DIB which is created/rendered/
painted by the methods of a software and this DIB should go
directly into the Tkinter frame.


More information about the Tkinter-discuss mailing list