Advertisement
MrPoxipol

Embeding XWindow in Gtk.DrawingArea

Dec 11th, 2014
508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. from gi.repository import Gtk, Gdk, GdkX11
  4.  
  5. WIDTH = 800
  6. HEIGHT = 600
  7.  
  8. drawing_area = Gtk.DrawingArea()
  9. drawing_area.set_size_request(WIDTH, HEIGHT)
  10. drawing_area.add_events(Gdk.EventMask.ALL_EVENTS_MASK)
  11. drawing_area.set_double_buffered(False)
  12. drawing_area.realize()
  13.  
  14. window = Gtk.Window()
  15. window.add(drawing_area)
  16.  
  17. window.connect('delete-event', Gtk.main_quit)
  18. window.show_all()
  19.  
  20. # Just for sure
  21. drawing_area.get_window().resize(WIDTH, HEIGHT)
  22.  
  23. xid = drawing_area.get_window().get_xid()
  24. print('export LIBSOY_X11_WID=%s' % xid)
  25.  
  26. Gtk.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement