예제 #1
0
def main():
	win = Gtk.Window.new(Gtk.WindowType.toplevel)
	win.connect('destroy', lambda w: Gtk.main_quit())
	win.set_default_size(450, 550)
	
	drawingarea = Gtk.DrawingArea.new()
	# drawingarea.connect('expose_event', expose)
	win.add(drawingarea)
	
	win.show_all()
	Gtk.main()
예제 #2
0
def main(skip_main=False):
	Gtk.init(len(sys.argv), sys.argv)
	window = Gtk.Window.new(Gtk.WindowType.toplevel)
	window.set_title('Test 1')
	vbox = Gtk.VBox.new(False, 0)
	label = Gtk.Label.new('Hello world!')
	vbox.pack_start(label, True, True, 10)
	button = Gtk.Button.new_from_stock('gtk-quit')
	button.connect('clicked', cb_button_clicked)
	vbox.pack_start(button, False, True, 0)
	window.add(vbox)
	window.show_all()
	window.connect('delete-event', cb_window_delete_event)
	window.connect('destroy', cb_window_destroy)
	if not skip_main: Gtk.main()
예제 #3
0
def main(skip_main=False):
    Gtk.init(len(sys.argv), sys.argv)
    window = Gtk.Window.new(Gtk.WindowType.toplevel)
    window.set_title('Test 1')
    vbox = Gtk.VBox.new(False, 0)
    label = Gtk.Label.new('Hello world!')
    vbox.pack_start(label, True, True, 10)
    button = Gtk.Button.new_from_stock('gtk-quit')
    button.connect('clicked', cb_button_clicked)
    vbox.pack_start(button, False, True, 0)
    window.add(vbox)
    window.show_all()
    window.connect('delete-event', cb_window_delete_event)
    window.connect('destroy', cb_window_destroy)
    if not skip_main: Gtk.main()
예제 #4
0
def cb_window_delete_event(window, *args, **kwargs):
    print('cb_window_delete_event:', window, args, kwargs)
    return False


def cb_window_destroy(window, *args, **kwargs):
    print('cb_window_destroy:', window, args, kwargs)
    Gtk.main_quit()


def cb_button_clicked(button, *args, **kwargs):
    print('cb_button_clicked:', window, args, kwargs)
    Gtk.main_quit()


if __name__ == '__main__':
    window = Gtk.Window.new(Gtk.WindowType.toplevel)
    window.set_title(__file__)
    vbox = Gtk.VBox(homogeneous=False, spacing=0)
    label = Gtk.Label(label='Hello world!')
    vbox.pack_start(label, True, True, 10)
    button = Gtk.Button.new_from_stock('gtk-quit')
    button.connect('clicked', cb_button_clicked)
    vbox.pack_start(button, False, True, 0)
    window.add(vbox)
    window.show_all()
    window.connect('delete-event', cb_window_delete_event)
    window.connect('destroy', cb_window_destroy)
    Gtk.main()
예제 #5
0
def main():
	MainWindow()
	Gtk.main()
예제 #6
0
sys.path.append('..')

from gir import Gtk

def cb_window_delete_event(window, *args, **kwargs):
	print('cb_window_delete_event:', window, args, kwargs)
	return False

def cb_window_destroy(window, *args, **kwargs):
	print('cb_window_destroy:', window, args, kwargs)
	Gtk.main_quit()

def cb_button_clicked(button, *args, **kwargs):
	print('cb_button_clicked:', window, args, kwargs)
	Gtk.main_quit()

if __name__ == '__main__':
	window = Gtk.Window.new(Gtk.WindowType.toplevel)
	window.set_title(__file__)
	vbox = Gtk.VBox(homogeneous=False, spacing=0)
	label = Gtk.Label(label='Hello world!')
	vbox.pack_start(label, True, True, 10)
	button = Gtk.Button.new_from_stock('gtk-quit')
	button.connect('clicked', cb_button_clicked)
	vbox.pack_start(button, False, True, 0)
	window.add(vbox)
	window.show_all()
	window.connect('delete-event', cb_window_delete_event)
	window.connect('destroy', cb_window_destroy)
	Gtk.main()