Opacity of individual widgets in WXPython
Is it possible to control the opacity of individual widgets in WXPython?
I know I can make 开发者_运维技巧the Frame transparent with self.SetTransparent(150), is there a way to do this for individual widgets?
Since nearly everything visible inherits from wx.Window, you can use item.SetTransparent() on most widgets.
Not everything can go transparent though. To check:
if button.CanSetTransparent():
button.SetTransparent(100)
But as the wxPython documentation says:
Returns True if the platform supports setting the transparency for this window. Note that this method will err on the side of caution, so it is possible that this will return False when it is in fact possible to set the transparency.
So this isn't very reliable. I would just go ahead and try to set the transparency.
精彩评论