[wxpython-users] Re: The new StaticBitmap is dead, long live the old StaticBitmap!

Alex alexandru.tabac at gmail.com
Tue Apr 1 05:10:53 PDT 2008


Peter Damoc <pdamoc <at> gmail.com> writes:

> 
> 
> Hi Alex,The best way (in my view) to do what you want to do is create an empty
bitmap with alpha channel, load it into a wx.MemoryDC and after that draw on it
what you need in this case a FloodFill with that yellowish color.here is some
code for the EmptyBitmapRGBAdef EmptyBitmapRGBA((width, height)):   bytes =
array.array('B', [0] * width*height*4)   return wx.BitmapFromBufferRGBA(width,
height, bytes)Maybe if enough people would start using this kind of bitmaps we
will get it in the wx namespace, created in C++ , without depending on the array
module which is painfully slow.Peter

Well that seems kinda backward. You see, I can have anywhere from 1 to 30
small(30px squarish) StaticBitmaps, they're each coupled to a slider, and they
change color whenever the slider is moved. (The slider represents a position
over a gradient with up to 256 values). So.. I don't know what's worse, constant
Raw Pixel Access, or constant drawing on a memoryDC.

Now, since you DID see the color(I'm on winXP now, the mac's home) I assume that
it works for you. I only saw a black square.



More information about the wxpython-users mailing list