wxpython display jpg in a frame

M

max4

hello
i would like to know if there is a good tutorial about how to do this
or if someone could explain

thank you

[ i want to add a jpg to an existing about dialog]
 
C

Cliff Wells

hello
i would like to know if there is a good tutorial about how to do this
or if someone could explain
[ i want to add a jpg to an existing about dialog]


Capture the PAINT event and use a PaintDC to draw to the dialog:

class MyDialog(wx.Dialog):
def __init__(self, ...):
...
EVT_PAINT(self, self.OnPaint)


def OnPaint(self, event):
dc = wxPaintDC(self)
dc.DrawBitmap(bitmap, ...)
event.Skip()


BTW, questions about wxPython are better asked on the wxPython list:

http://www.wxpython.org/maillist.php

Regards,
 
D

David C. Fox

max4 said:
hello
i would like to know if there is a good tutorial about how to do this
or if someone could explain

thank you

[ i want to add a jpg to an existing about dialog]


Create a wxImage from the jpg file, and then a wxBitmap from the image,
then a wxStaticBitmap control from the bitmap.

for example,

i = wxImage("about.jpg", wxBITMAP_TYPE_JPEG)
b = wxBitmapFromImage(i)
sb = wxStaticBitmap(dialog, b, pos, size)

As usual, see the wxPython demo for more details.

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top