I'm not sure what's causing the constant-refresh problem you're seeing from this, though I'd suggest that you look at what events you're handling--if, for
instance, you're resizing your image in response to EVT_SIZE, then you'll end up in an infinite resizing loop (as your resizing generates another EVT_SIZE,
which causes you to resize again...). You're probably not tripping over *that* particular gotcha, but maybe something similar--you might try posting a
list of the events you're handling, and a brief one- or two-line summary of what each handler does.
However, you do have a bit of unnecessary/questionable parameters in your code above. Remember that most wxPython methods have sensible defaults, and only
specify parameters if you really need something other than the default. Your code above could probably be:
self.bitmap = wxStaticBitmap( self, #parent
wxNewId(), # ID - don't use a wx constant for this
wxEmptyBitmap(800,600) ) # bitmap
# Other parameters can use defaults
vsizer.Add(self.bitmap, 1, wxGROW | wxALL, 10)
Is wxID_BITMAP a constant that you've defined yourself? (I don't seem to have it defined...) If so, and if you really want to use a specific ID number,
then it would be clearer to use a name for it that *doesn't* start with wx -- that should be reserved for things that are actually part of the wxPython
distribution. (It gets confusing otherwise, plus it's hard to be sure that you won't be stomping on a name that wxPython *does* use.) But unless you're
referring to this static bitmap elsewhere by the ID number (and I'd think that just using self.bitmap would be simpler...) then you're probably safer just
using wxNewId() to let wxWindows pick an unused ID number on its own.
Jeff Shannon
Technician/Programmer
Credit International
ยทยทยท
Andreas Kostyrka <andreas@mtg.co.at> wrote:
Beside having problem creating (empty) wxBitmaps, I've got the problem,
that wxStaticBitmap seems constantly to refresh the image -> the images
flashes, and the X server is getting to 95% CPU usage
....
self.bitmap=wxStaticBitmap(self, # parent
wxID_BITMAP, # id
wxEmptyBitmap(800,600),
wxDefaultPosition,
wxSize(800,600),
0,
"staticBitmap")
....
vsizer.Add(self.bitmap, 1,
wxGROW>wxALL,10, None)