Reputation: 52911
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?
Upvotes: 2
Views: 701
Reputation: 3845
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.
Upvotes: 5