wxpython display jpg in a frame

Discussion in 'Python' started by max4, Jul 22, 2003.

  1. max4

    max4 Guest

    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]
     
    max4, Jul 22, 2003
    #1
    1. Advertising

  2. max4

    Cliff Wells Guest

    On Tue, 2003-07-22 at 12:32, max4 wrote:
    > 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,

    --
    Cliff Wells, Software Engineer
    Logiplex Corporation (www.logiplex.net)
    (503) 978-6726 (800) 735-0555
     
    Cliff Wells, Jul 22, 2003
    #2
    1. Advertising

  3. max4

    David C. Fox Guest

    max4 wrote:

    > 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
     
    David C. Fox, Jul 22, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roland
    Replies:
    0
    Views:
    1,096
    Roland
    May 12, 2004
  2. Matthias
    Replies:
    5
    Views:
    464
    Whitecrest
    Jun 1, 2004
  3. Yannick

    ASP changes Big JPG -> Small JPG

    Yannick, Feb 2, 2004, in forum: ASP General
    Replies:
    6
    Views:
    172
    Tim Williams
    Feb 3, 2004
  4. Vilmar Brazão de Oliveira
    Replies:
    14
    Views:
    380
    Aaron Bertrand [MVP]
    Mar 5, 2004
  5. Replies:
    3
    Views:
    280
    Andy Dingley
    Sep 27, 2006
Loading...

Share This Page