From the wxWindows docs, it looks like that I can resize a wxBitmap with
the SetHeight and SetWidth methods, but I'm not having success. Here is
a very simple complete example that reproduces my problem:
···
#################
from wxPython.wx import *
app = wxPySimpleApp()
redLine = wxEmptyImage(10,1)
redLine.SetData((chr(255)+"\0\0") * 10)
bmp = wxEmptyBitmap(10,20)
dc = wxMemoryDC()
dc.SelectObject(bmp)
print "garbage:",[dc.GetPixel(i, 7).asTuple() for i in range(10)]
dc.DrawBitmap(wxBitmapFromImage(redLine, -1), 0, 7)
print "red:", [dc.GetPixel(i, 7).asTuple() for i in range(10)]
bmp.SetHeight(30)
dc.DrawBitmap(wxBitmapFromImage(redLine, -1), 0, 15)
print "red 2:", [dc.GetPixel(i, 15).asTuple() for i in range(10)]
dc.DrawBitmap(wxBitmapFromImage(redLine, -1), 0, 25)
print "shoud be red:", [dc.GetPixel(i, 25).asTuple() for i in range(10)]
######################
Here is the weird output:
garbage: [(0, 0, 0), (0, 0, 0), (130, 155, 0), (0, 0, 0), (0, 0, 0), (0,
231, 82), (40, 255, 0), (0, 0, 0), (40, 255, 0), (0, 0, 0)]
red: [(255, 0, 0), (255, 0, 0), (255, 0, 0), (255, 0, 0), (255, 0, 0),
(255, 0, 0), (255, 0, 0), (255, 0, 0), (255, 0, 0), (255, 0, 0)]
red 2: [(255, 0, 0), (255, 0, 0), (255, 0, 0), (255, 0, 0), (255, 0, 0),
(255, 0, 0), (255, 0, 0), (255, 0, 0), (255, 0, 0), (255, 0, 0)]
shoud be red: [(0, 0, 88), (0, 0, 88), (0, 0, 88), (0, 0, 88), (0, 0,
88), (0, 0, 88), (0, 0, 88), (0, 0, 88), (0, 0, 88), (0, 0, 88)]
Why the last line isn't red? Am I misunderstanding something or there's
really a memory error?
My project has been fixed in using wxPython-2.4.2.4 and python 2.3.3
(I can't upgragrade them).
Thanks in advance for any answer.
--
Paulo Neves <neves@gisplan.com.br>
Gisplan