[wxPython-users] Transparent Windows Redux
Robin Dunn
robin at alldunn.com
Fri Jul 7 23:04:02 PDT 2006
Kevin Watters wrote:
> Thanks to some code posted to this mailing list I've got transparent windows
> going on wxMSW with the help of the ctypes module.
>
> Now I'm looking for the equivalents on wxMAC and wxGTK. I know from googling
> that wxWindow::GetHandle() returns something called a ControlRef (which is just
> an integer) on wxMAC. My knowledge of Carbon/Cocoa is nil, so I don't know the
> required call to set the window for that ControlRef's transparency. I do have,
> however, PyObjC installed, so I know such calls are possible.
There is some code in PyAUI that uses ctypes on Mac OSX to do
transparencies there too.
import ctypes
_carbon_dll =
ctypes.cdll.LoadLibrary(r'/System/Frameworks/Carbon.framework/Carbon')
handle = _carbon_dll.GetControlOwner(wnd.GetHandle())
if amount == 0:
amnt = float(0)
else:
amnt = float(amount)/255.0 #convert from the 0-255 amount
to the float that Carbon wants
_carbon_dll.SetWindowAlpha(handle, ctypes.c_float(amnt))
> Also, is there an easy approach for wxGTK to take as well?
I'm looking for some solutions for GTK, but nothing real solid yet.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list