Gdk.X11Window get_xid() strange behaviour



Hi,

Found some strange behaviour here:

This code:

from gi.repository import Gtk
w = Gtk.Window()
w.realize()
print w.get_window()
print w.get_window().get_xid()


Fails with:

<gtk.gdk.X11Window object at 0xb7438d9c (GdkX11Window at 0x9db11f8)>
Traceback (most recent call last):
  File "test.py", line 5, in <module>
    print w.get_window().get_xid()
AttributeError: 'gtk.gdk.X11Window' object has no attribute 'get_xid'



However, if I add a GdkX11 import (only change is in line 1):

from gi.repository import Gtk, GdkX11
w = Gtk.Window()
w.realize()
print w.get_window()
print w.get_window().get_xid()


Now it works:

<X11Window object at 0xb7419a7c (GdkX11Window at 0x95e71f8)>
46137347


In this case I would expect the GdkX11 import to be irrelevant, but
that seems not to be the case.

Thanks,
Daniel


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]