Esempio n. 1
0
	def __init__(self):
		print('MainWindow.__init__', self)
		Gtk.Window.__init__(self)
		screen = self.get_screen()
		self.set_screen(screen)
		self.set_title('Test 1')
		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', self.cb_button_clicked)
		vbox.pack_start(button, False, True, 0)
		self.add(vbox)
		self.show_all()
		self.connect('delete-event', self.cb_window_delete_event)
		self.connect('destroy', self.cb_window_destroy)
Esempio n. 2
0
	def __init__(self, parent=None):
		Gtk.Window.__init__(self)
		self.set_title(__file__)
		self.set_resizable(False)
		self.connect('destroy', lambda *w: Gtk.main_quit())
		
		vbox = Gtk.VBox(homogeneous=False, spacing=0)
		self.add(vbox)
		vbox.set_border_width(5)
		
		label = Gtk.Label(label='')
		label.set_markup("Completion demo, try writing <b>total</b> or <b>gnome</b> for example.")
		vbox.pack_start(label, False, False, 0)
		
		entry = Gtk.Entry()
		completion = Gtk.EntryCompletion()
		completion_model = self.create_completion_model()
		completion.set_model(completion_model)
		completion.set_text_column(0)
		entry.set_completion(completion)
		vbox.pack_start(entry, False, False, 0)
		
		self.show_all()
Esempio n. 3
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()