[wxpython-users] Re: The new StaticBitmap is dead, long
live the old StaticBitmap!
Alex
alexandru.tabac at gmail.com
Mon Mar 31 23:51:23 PDT 2008
Tim van der Leeuw <tnleeuw <at> gmail.com> writes:
> Could you perhaps show us some sample-code? (I had no problem creating a
> Static Bitmap from an Image created from PIL, the other day, using Vista +
> wxPython 2.8.7.1)Cheers,--Tim
Sure.
----------------------------------------------------------------------------
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import wx
import wx.lib.inspection
app = wx.App(redirect=True,filename='debug.log')
frame = wx.Frame(None, -1, 'simple.py', size=(200,200))
panel = wx.Panel(frame)
bmp = wx.EmptyBitmap(200,200,-1)
pixels = wx.AlphaPixelData(bmp)
for pixel in pixels:
pixel.Set(100,100,0,128)
static = wx.StaticBitmap(parent=panel, bitmap=bmp)
frame.Show()
wx.lib.inspection.InspectionTool().Show()
app.MainLoop()
-----------------------------------------------------------------------------
Using wx.NativePixelData gives me an error, because apparently,
wx.NativePixelData chokes on wx.Bitmap-s. I tried wx.NativePixelData because at
first I thought that winXP somehow disliked the presence of an alpha channel,
but as I remember winXP could deal OK with alphas.
More information about the wxpython-users
mailing list