print('height', win.get_height()) if __name__ == '__main__': gtk.init() win = gtk.Window() win.set_size_request(640, 480) # xembed requires window is >= win.set_title('xembed test') frame = gtk.Frame('xembed test') win.add(frame) widget = Widget(frame) win.connect('destroy', widget.exit) win.show_all() ok = False while widget.active: if gtk.gtk_events_pending(): while gtk.gtk_events_pending(): gtk.gtk_main_iteration() if not ok: # must come after gtk iteration ok = True widget.popen(['/usr/bin/gcalctool'], 'Calculator') ############ blender quits without --window-borderless ########### #cmd = [os.path.expanduser('~/Blender2.6/blender'), '--window-borderless'] #cmd += '--window-geometry 0 0 640 480'.split() #widget.popen( cmd, 'Blender' )
def on_motion(w, event): print('on motion', w, event) #a = gtk.Label('motion notify event') b = gtk.EventBox() b.add(gtk.Label('drag me')) box.pack_start(b, expand=True) b.add_events(gtk.GDK_POINTER_MOTION_MASK) b.connect('motion-notify-event', on_motion) def change_combo(combo): print('combo changed', combo) print(combo.get_active_text()) combo = gtk.ComboBoxText() box.pack_start(combo) for txt in 'hello world'.split(): combo.append('id', txt) combo.connect('changed', change_combo) win.show_all() #gtk.main() while True: if gtk.gtk_events_pending(): gtk.gtk_main_iteration() print('exit')
print("height", win.get_height()) if __name__ == "__main__": gtk.init() win = gtk.Window() win.set_size_request(640, 480) # xembed requires window is >= win.set_title("xembed test") frame = gtk.Frame("xembed test") win.add(frame) widget = Widget(frame) win.connect("destroy", widget.exit) win.show_all() ok = False while widget.active: if gtk.gtk_events_pending(): while gtk.gtk_events_pending(): gtk.gtk_main_iteration() if not ok: # must come after gtk iteration ok = True widget.popen(["/usr/bin/gcalctool"], "Calculator") ############ blender quits without --window-borderless ########### # cmd = [os.path.expanduser('~/Blender2.6/blender'), '--window-borderless'] # cmd += '--window-geometry 0 0 640 480'.split() # widget.popen( cmd, 'Blender' )
############################## if 0: # segfaults!? def on_motion(w,event): print('on motion',w,event) #a = gtk.Label('motion notify event') b = gtk.EventBox(); b.add( gtk.Label('drag me') ) box.pack_start( b, expand=True ) b.add_events( gtk.GDK_POINTER_MOTION_MASK ) b.connect('motion-notify-event', on_motion) def change_combo(combo): print('combo changed', combo) print( combo.get_active_text() ) combo = gtk.ComboBoxText() box.pack_start( combo ) for txt in 'hello world'.split(): combo.append('id', txt) combo.connect('changed', change_combo ) win.show_all() #gtk.main() while True: if gtk.gtk_events_pending(): gtk.gtk_main_iteration() print('exit')