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

Metz, Bobby W, WWCS bwmetz at att.com
Fri Sep 1 19:05:24 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.


-----Original Message-----
From: tkinter-discuss-bounces at python.org
[mailto:tkinter-discuss-bounces at python.org]On Behalf Of Reiner M. Stoss
Sent: Friday, September 01, 2006 2:40 AM
To: tkinter-discuss at python.org
Subject: Re: [Tkinter-discuss] How to get DIB into Tkinter frame?


> is PaintPicture rendering into a HDC?
> can you get it to render to an ordinary bitmap?

Here is the description of this method from the reference:

PlateDIB.PaintPicture() Method

Copy the DIB bitmap to another using BitBlt.


The method syntax has these parts:

Part Description 
DeviceContext (Long) Handle to a GDI device context
containing the destination bitmap (HDC, Long)
Return (Nothing) Does not return a value. 

Paints the bitmap in the PlateDIB object onto a bitmap
in some other Windows Graphics Device Interface device.
>From Visual Basic, you can paint into a Picture control.
For example, suppose you have a form with a Picture
control on it named picImage, and a PlateDIB object
that has been Create()ed and Render()ed named pdM104: 

pdM104.PaintPicture picImage.handle

I am new to Tkinter so this might be an easy
problem for an expert but it is above my knowledge.
I have lost already days with it :-(

I was even wondering what HDC means. I see in VB
that the PictureBox has a property called "HasDC"
and it works with "m.PaintPicture Picture1.hDC"
but I do not want to use VB at all and do all in
Python/Tkinter. So the VB code snippet was just intended
as a help to understanding the problem.


Tkinter-discuss mailing list
Tkinter-discuss at python.org

More information about the Tkinter-discuss mailing list