It seems that primarily the wx.Frame supports transparency of values other then just zero and 255. But wx.Panel does not. Or I’m not doing it right. What is the simplest way to change the transparency of a wx.Panel to a value other then 0 or 255?
I am using Python 2.7.2 that is distributed with Panda3d 1.8.x
wxPython version: 2.8.12.1 (msw-unicode)
Windows XP SP3
‘’‘How do you set the alpha of a wx.Panel?’’’
if name == ‘main’:
import wx
app = wx.App( 0 )
frame = wx.Frame( None )
p0 = wx.Panel( frame )
p0.SetBackgroundColour( ‘GREEN’ )
p00 = wx.Panel( p0, size=( 200,100 ) )
p00.SetBackgroundColour( ‘MAGENTA’ )
#p01 = wx.Panel( p0, size=( 200,100 ) )
#p01 = wx.Window( p0, size=( 200,100 ), style = wx.USER_COLOURS )
p01 = wx.Panel( p0, size=( 200,100 ), style = wx.USER_COLOURS )
ctrl = wx.Button(p01, label='All or nothing')
transblue = wx.Colour( 0,0,100, 128)
p01.SetBackgroundColour( transblue )
#p01.SetBackgroundColour( ‘BLUE’ )
p01.SetTransparent( 128)
flags = wx.ALL | wx.EXPAND
p0sizer = wx.BoxSizer( wx.VERTICAL )
p0sizer.Add( p00, 1, flags, 5 )
p0sizer.Add( p01, 1, flags, 5 )
p0.SetSizer( p0sizer )
f0sizer = wx.BoxSizer( wx.VERTICAL )
f0sizer.Add( p0, 0, wx.ALL, 5 )
frame.SetSizer( f0sizer )
frame.Show()
app.MainLoop()