wx.Window.SetTransparent on Ubuntu with a timer.

On Ubuntu 11.04 & python-wxgtk2.8 (2.8.11.0-0ubuntu8) when calling SetTransparent in a timer callback, I’m unable to set the window to the desired opacity. It works for me on Win 7/XP and Mac OSX 10.6. Calling SetTransparent outside of a timer also works for me on Ubuntu.

Small test case attached based on - http://wiki.wxpython.org/Transparent Frames and http://www.blog.pythonlibrary.org/2008/04/14/doing-a-fade-in-with-wxpython

What I’ve tried so far (not shown in the test case), neither of which worked:

  • using a wx.Timer instead of a wx.PyTimer and manually binding the AlphaCycle handler to the timer event,
  • creating a custom event class which AlphaCycle posts, the main window has a handler bound to that event which calls self.SetTransparent outside of the timer.

Any suggestions?

test.py (1.13 KB)

Sorry, no idea. It does work on 10.10, so it must be something related to 11.04. Perhaps transparency can't change after the frame has been shown or something like that. Please create a ticket about it at trac.wxwidgets.org and hopefully one of the GTK experts will know what to do about it.

···

On 5/20/11 4:12 PM, Luke wrote:

On Ubuntu 11.04 & python-wxgtk2.8 (2.8.11.0-0ubuntu8) when calling
SetTransparent in a timer callback, I'm unable to set the window to the
desired opacity. It works for me on Win 7/XP and Mac OSX 10.6. Calling
SetTransparent outside of a timer also works for me on Ubuntu.

Small test case attached based on - http://wiki.wxpython.org/Transparent
Frames and
Doing a Fade-in with wxPython - Mouse Vs Python

What I've tried so far (not shown in the test case), neither of which
worked:
- using a wx.Timer instead of a wx.PyTimer and manually binding the
AlphaCycle handler to the timer event,
- creating a custom event class which AlphaCycle posts, the main window
has a handler bound to that event which calls self.SetTransparent
outside of the timer.

Any suggestions?

--
Robin Dunn
Software Craftsman

Thanks, I’ll file a ticket. BTW after a bit of playing around, it doesn’t seem to be related to the frame being shown, rather the transparency won’t change after the app.MainLoop is running.

Luke

wxWidgets trac ticket: http://trac.wxwidgets.org/ticket/13240