[wxPython-users] paintdc usage
Christopher Barker
Chris.Barker at noaa.gov
Tue Sep 5 15:00:37 PDT 2006
Jim Geurts wrote:
> I'm trying to draw a bitmap as the background for one of my wx.Frames.
> class MyPanel(wx.Panel):
> def __init__(self, parent):
> wx.Panel.__init__(self, parent, wx.ID_ANY)
>
> self.Bind(wx.EVT_PAINT, self.OnPaint, self)
>
> def OnPaint(self, event):
> dc = wx.PaintDC(self)
> bmp = wx.Image('mybg.jpg').ConvertToBitmap()
> dc.DrawBitmap(bmp, 0, 0)
>
>
>
> is there something glaring that I'm doing wrong?
I don't see anything wrong with this code. How are you using it? Is the
Image the same size as the Panel? Put this in a small, complete app, and
see if it works. If not, post the whole thing here, and we'll see if we
can figure out what it wrong.
Have you read the Wiki pages on Images and Bitmaps and graphics? There's
some good stuff there.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the wxpython-users
mailing list