embedding an XWindow in a wxPython app

I need to dump streaming video into a window. On linux this requires an
xwindowID to dump it in. I looks like this is perfectly doable in pygtk
(create a DrawingArea()), but I wan tot do it in wxPython (which uses
GTK on Linux as well).

So my question is how do I do this? Can I in wxPython create a DC and
get the xwindowID off that???

Paul

···

--
Paul Sijben tel: +31334566488
Eemvalley Technology fax: +31334557523
the Netherlands http://eemvalley.com

You can use GetHandle on a wxWindow to get the GtkWidget*for the
underlying GTK widget and then some ctypes (or maybe pyrex, if the GTK
functions you need are actually macros) calls to get the XID out of
the GtkWidget.

···

On 10/11/07, Paul Sijben <sijben@eemvalley.com> wrote:

I need to dump streaming video into a window. On linux this requires an
xwindowID to dump it in. I looks like this is perfectly doable in pygtk
(create a DrawingArea()), but I wan tot do it in wxPython (which uses
GTK on Linux as well).

So my question is how do I do this? Can I in wxPython create a DC and
get the xwindowID off that???

Paul

great, thanks!

Chris Mellon wrote:

···

sijben@eemvalley.comwxPython-users-unsubscribe@lists.wxwidgets.orgwxPython-users-help@lists.wxwidgets.org

-- Paul Sijben tel: +31334566488
Eemvalley Technology fax: +31334557523
the Netherlands

http://eemvalley.com

Chris Mellon wrote:

···

On 10/11/07, Paul Sijben <sijben@eemvalley.com> wrote:

I need to dump streaming video into a window. On linux this requires an
xwindowID to dump it in. I looks like this is perfectly doable in pygtk
(create a DrawingArea()), but I wan tot do it in wxPython (which uses
GTK on Linux as well).

So my question is how do I do this? Can I in wxPython create a DC and
get the xwindowID off that???

Paul

You can use GetHandle on a wxWindow to get the GtkWidget*for the
underlying GTK widget and then some ctypes (or maybe pyrex, if the GTK
functions you need are actually macros) calls to get the XID out of
the GtkWidget.

Actually, wxPython's GetHandle is returning the XWindow. I changed the wrapper for it because we've had lots more requests over the years for the XWindow handle than for the GtkWidget pointer.

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

This would explain the mysterious segfaults I was getting when I was
trying to do this myself... no wonder! Is there any access to the
GtkWidget then, or is there a GTK function to retrieve the widget from
the XWindow?

···

On 10/11/07, Robin Dunn <robin@alldunn.com> wrote:

Chris Mellon wrote:
> On 10/11/07, Paul Sijben <sijben@eemvalley.com> wrote:
>> I need to dump streaming video into a window. On linux this requires an
>> xwindowID to dump it in. I looks like this is perfectly doable in pygtk
>> (create a DrawingArea()), but I wan tot do it in wxPython (which uses
>> GTK on Linux as well).
>>
>> So my question is how do I do this? Can I in wxPython create a DC and
>> get the xwindowID off that???
>>
>> Paul
>
> You can use GetHandle on a wxWindow to get the GtkWidget*for the
> underlying GTK widget and then some ctypes (or maybe pyrex, if the GTK
> functions you need are actually macros) calls to get the XID out of
> the GtkWidget.

Actually, wxPython's GetHandle is returning the XWindow. I changed the
wrapper for it because we've had lots more requests over the years for
the XWindow handle than for the GtkWidget pointer.

Chris Mellon wrote:

···

On 10/11/07, Robin Dunn <robin@alldunn.com> wrote:

Chris Mellon wrote:

On 10/11/07, Paul Sijben <sijben@eemvalley.com> wrote:

I need to dump streaming video into a window. On linux this requires an
xwindowID to dump it in. I looks like this is perfectly doable in pygtk
(create a DrawingArea()), but I wan tot do it in wxPython (which uses
GTK on Linux as well).

So my question is how do I do this? Can I in wxPython create a DC and
get the xwindowID off that???

Paul

You can use GetHandle on a wxWindow to get the GtkWidget*for the
underlying GTK widget and then some ctypes (or maybe pyrex, if the GTK
functions you need are actually macros) calls to get the XID out of
the GtkWidget.

Actually, wxPython's GetHandle is returning the XWindow. I changed the
wrapper for it because we've had lots more requests over the years for
the XWindow handle than for the GtkWidget pointer.

This would explain the mysterious segfaults I was getting when I was
trying to do this myself... no wonder! Is there any access to the
GtkWidget then,

No, but I can add one.

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

That'd be awesome.

···

On 10/11/07, Robin Dunn <robin@alldunn.com> wrote:

Chris Mellon wrote:
> On 10/11/07, Robin Dunn <robin@alldunn.com> wrote:
>> Chris Mellon wrote:
>>> On 10/11/07, Paul Sijben <sijben@eemvalley.com> wrote:
>>>> I need to dump streaming video into a window. On linux this requires an
>>>> xwindowID to dump it in. I looks like this is perfectly doable in pygtk
>>>> (create a DrawingArea()), but I wan tot do it in wxPython (which uses
>>>> GTK on Linux as well).
>>>>
>>>> So my question is how do I do this? Can I in wxPython create a DC and
>>>> get the xwindowID off that???
>>>>
>>>> Paul
>>> You can use GetHandle on a wxWindow to get the GtkWidget*for the
>>> underlying GTK widget and then some ctypes (or maybe pyrex, if the GTK
>>> functions you need are actually macros) calls to get the XID out of
>>> the GtkWidget.
>> Actually, wxPython's GetHandle is returning the XWindow. I changed the
>> wrapper for it because we've had lots more requests over the years for
>> the XWindow handle than for the GtkWidget pointer.
>>
>>
>
> This would explain the mysterious segfaults I was getting when I was
> trying to do this myself... no wonder! Is there any access to the
> GtkWidget then,

No, but I can add one.

Chris Mellon wrote:

getgtkwidget.patch (1.42 KB)

···

On 10/11/07, Robin Dunn <robin@alldunn.com> wrote:

Chris Mellon wrote:

On 10/11/07, Robin Dunn <robin@alldunn.com> wrote:

Chris Mellon wrote:

On 10/11/07, Paul Sijben <sijben@eemvalley.com> wrote:

I need to dump streaming video into a window. On linux this requires an
xwindowID to dump it in. I looks like this is perfectly doable in pygtk
(create a DrawingArea()), but I wan tot do it in wxPython (which uses
GTK on Linux as well).

So my question is how do I do this? Can I in wxPython create a DC and
get the xwindowID off that???

Paul

You can use GetHandle on a wxWindow to get the GtkWidget*for the
underlying GTK widget and then some ctypes (or maybe pyrex, if the GTK
functions you need are actually macros) calls to get the XID out of
the GtkWidget.

Actually, wxPython's GetHandle is returning the XWindow. I changed the
wrapper for it because we've had lots more requests over the years for
the XWindow handle than for the GtkWidget pointer.

This would explain the mysterious segfaults I was getting when I was
trying to do this myself... no wonder! Is there any access to the
GtkWidget then,

No, but I can add one.

That'd be awesome.

Done. It just returns a long int with the value of the pointer like GetHandle does. so it will take additional steps to turn it into a usable GtkWidget object:

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