>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.
Bobby -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Reiner M. Stoss Sent: Thursday, August 31, 2006 2:03 PM To: [email protected] Subject: [Tkinter-discuss] How to get DIB into Tkinter frame? Folks, I have a problem. I have a scriptable software that works with images in FITS format (astronomical images). It can generate Windows device-independent bitmaps (DIB) and paint them as picture into any device context including Picture controls in Visual Basic, etc. Here is VB sample code that works for me: --- 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 p.DetachFITS End Sub --- The PaintPicture method sends the picture into the PictureBox Picture1. Now how to do the same in Python/Tkinter? I have something as this: --- p = win32com.client.dynamic.Dispatch('PinPoint.Plate') p.AttachFITS('M:/Images/LaSagra/20060828/012128+170000-sagra21-S001-R001 .fts') m = p.NewPlateDIB() m.Create(1, 1, 1, 1) m.Render(60000, 0) m.PaintPicture(im) #Here some Tkinter lines like root = Tk() etc. def expose(event): dib = ImageWin.Dib(im) dib.expose(ImageWin.HDC(left_frame.winfo_id())) left_frame.bind("", expose) p.DetachFITS() --- But it crashes with this message: --- Traceback (most recent call last): File "L:\pin.py", line 91, in ? m.PaintPicture(im) NameError: name 'im' is not defined --- Clearly the problem is the argument I provide when I call PaintPicture(). So how to get the picture painted by PaintPicture() into a Tkinter frame? Thanks, Reiner _______________________________________________ Tkinter-discuss mailing list [email protected] http://mail.python.org/mailman/listinfo/tkinter-discuss _______________________________________________ Tkinter-discuss mailing list [email protected] http://mail.python.org/mailman/listinfo/tkinter-discuss
