wxpython display jpg in a frame

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • max4

    wxpython display jpg in a frame

    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]
  • David C. Fox

    #2
    Re: wxpython display jpg in a frame

    max4 wrote:
    [color=blue]
    > 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][/color]


    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_J PEG)
    b = wxBitmapFromIma ge(i)
    sb = wxStaticBitmap( dialog, b, pos, size)

    As usual, see the wxPython demo for more details.

    David

    Comment

    • Cliff Wells

      #3
      Re: wxpython display jpg in a frame

      On Tue, 2003-07-22 at 12:32, max4 wrote:[color=blue]
      > 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][/color]


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

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


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


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



      Regards,

      --
      Cliff Wells, Software Engineer
      Logiplex Corporation (www.logiplex.net)
      (503) 978-6726 (800) 735-0555


      Comment

      Working...