Is there an equivalent to gdk_window_ensure_native in PyGtk? I need it to unbreak drawing OpenGl to widget in Gtk >= 2.18.
Asked
Active
Viewed 262 times
2 Answers
4
You can get the gtk.gdk.Window
of a widget/window using gtk.Widget.get_window()
, and then use undocumented gtk.gdk.Window.ensure_native()
, e.g.: my_widget.get_window().ensure_native()
. Works at least with pygtk2-2.17.0
I have available at hand.

abbot
- 27,408
- 6
- 54
- 57
1
Yes, there is:
>>> import gtk
>>> w = gtk.Window()
>>> w.show_all()
>>> gw = w.get_window()
>>> gw
<gtk.gdk.Window object at 0xa31e824 (GdkWindow at 0xa38ea28)>
>>> gw.ensure_native()
True
>>> gw.has_native()
True
Alternatively, You may try setting environmental variable GDK_NATIVE_WINDOWS=1

barti_ddu
- 10,179
- 1
- 45
- 53