[pygtk] Making part of a GTK-window transparent and position another window behind

Christoph David Hermann funkyhermann at gmail.com
Wed Feb 24 21:08:50 WST 2010


Am 24.02.2010 14:00, schrieb John Stowers:
> On Wed, 2010-02-24 at 13:36 +0100, Christoph David Hermann wrote:
>    
>> Hi John,
>>
>> thanks for your answer.
>>
>> I found an article on
>> http://mikehearn.wordpress.com/2006/03/26/gtk-windows-with-alpha-channels/
>> which uses only alpha channels, no mask and no set_opacity for window
>> transparency. I'll give this a try.
>>
>> Additionally, I have this strange feeling that alpha channels and
>> opacity aren't supported by GTK on MS windows platforms.
>>      
> A lot of features that rely on window manager functionality are not
> guaranteed to work on windows, which is why I suspect that you will
> never achieve the result you wish using this approach.
>
> John
>    

ok, then I'll restrict my application platform to linux systems with a 
recent x server and extensions.

christoph

>    
>> Christoph
>>
>> Am 24.02.2010 13:19, schrieb John Stowers:
>>      
>>> On Tue, 2010-02-23 at 08:33 +0100, Christoph David Hermann wrote:
>>>
>>>        
>>>> Hello to all,
>>>>
>>>> I'm planning to develop a simulation game using panda3D
>>>> (http://www.panda3d.org/) and pygtk. Unfortunately, it is not possible
>>>> export an OpenGL-context from panda3D and directly draw on a GTK
>>>> widget using an OpenGL-extension. So I decided to draw the main window
>>>> with pygtk, make a part of the window transparent and position the
>>>> panda3D window behind it. I want the GTK-window to capture all
>>>> keyboard and mouse inputs.
>>>>
>>>> My approach was to use shape_combine_mask
>>>> (http://www.pygtk.org/docs/pygtk/class-gdkwindow.html#method-gdkwindow--shape-combine-mask) to make the right part of the window transparent. This works like a charme except for one thing: The GTK window isn't only transparent at the desired area; this area seems to be nonexistent, because if I click on this area the panda3D window captures my mouse input.
>>>>
>>>> So, is there a way of making parts of a window transparent without
>>>> making a "hole" in the window?
>>>>
>>>> Using a compositing manager and set_opacity
>>>> (http://www.pygtk.org/docs/pygtk/class-gtkwindow.html#method-gtkwindow--set-opacity) is no option, because running panda3D makes the composition manager crash and return to normal mode on my target platform.
>>>>
>>>> A solution which works on windows (xp and 7) and linux (ubuntu Karmic
>>>> Koala) would be nice ;-)
>>>>
>>>>          
>>> I suspect you might have more luck by hacking pygtkglext, or writing
>>> another small C extension to accept the gl-context from panda3d.
>>>
>>> John
>>>
>>>
>>>        
>>>> Thanks,
>>>> Christoph
>>>>
>>>> _______________________________________________
>>>> pygtk mailing list   pygtk at daa.com.au
>>>> http://www.daa.com.au/mailman/listinfo/pygtk
>>>> Read the PyGTK FAQ: http://faq.pygtk.org/
>>>>
>>>>          
>>>
>>>        
>>      
>
>    



More information about the pygtk mailing list