transparent wxpopupwindow?

Is it possible, and possible cross platform?

I couldn't find anything that suggested it was (as .SetTransparent()
seems to only be for top level windows).

Thanks.

C M wrote:

Is it possible, and possible cross platform?

No.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

HI All,

C M wrote:

Is it possible, and possible cross platform?

No.

Uhm, it is possible in Windows and should be possible on the Mac (but
I have no idea on GTK), although not withing wxPython. What I do on
Windows (and on Mac, thanks to Chris Mellon, using Carbon calls) for
my FlatMenu class, is to use either ctypes or Mark Hammond's win32all
extension, in this way (self is the popup window):

        # amount is the alpha transparency

        if wx.Platform == "__WXMSW__":
            hwnd = wnd.GetHandle()

            if not hasattr(self, "_winlib"):
                if _libimported == "MH": # Imported win32all
                    self._winlib = win32api.LoadLibrary("user32")
                elif _libimported == "ctypes": # import ctypes
                    self._winlib = ctypes.windll.user32

            if _libimported == "MH":
                pSetLayeredWindowAttributes =
win32api.GetProcAddress(self._winlib,

"SetLayeredWindowAttributes")

                if pSetLayeredWindowAttributes == None:
                    return

                exstyle = win32api.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
                if 0 == (exstyle & 0x80000):
                    win32api.SetWindowLong(hwnd, win32con.GWL_EXSTYLE,
exstyle | 0x80000)

                winxpgui.SetLayeredWindowAttributes(hwnd, 0, amount, 2)

            elif _libimported == "ctypes":
                style = self._winlib.GetWindowLongA(hwnd, 0xffffffecL)
                style |= 0x00080000
                self._winlib.SetWindowLongA(hwnd, 0xffffffecL, style)
                self._winlib.SetLayeredWindowAttributes(hwnd, 0, amount, 2)

        elif wx.Platform == "__WXMAC__" and _carbon_dll:
            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))

        else:

            # shouldn't be called, but just in case...
            return

HTH.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On Fri, Sep 26, 2008 at 7:50 AM, Robin Dunn wrote: