Exemplo n.º 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()
Exemplo n.º 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()
Exemplo n.º 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()
Exemplo n.º 4
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)
Exemplo n.º 5
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()
Exemplo n.º 6
0
	def create_completion_model(self):
		store = Gtk.ListStore.newv(1, [GObject.TYPE_STRING])
		iter = Gtk.TreeIter()
		
		iter = store.append(iter)
		store.set_value(iter, 0, 'gnome')
		
		iter = store.append(iter)
		store.set_value(iter, 0, 'total')
		
		iter = store.append(iter)
		store.set_value(iter, 0, 'totally')
		
		return store
Exemplo n.º 7
0
def cb_button_clicked(button, *args, **kwargs):
    print('cb_button_clicked:', window, args, kwargs)
    Gtk.main_quit()
Exemplo n.º 8
0
def cb_window_destroy(window, *args, **kwargs):
    print('cb_window_destroy:', window, args, kwargs)
    Gtk.main_quit()
Exemplo n.º 9
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()
Exemplo n.º 10
0
def cb_window_destroy(window, *args, **kwargs):
	print('cb_window_destroy:', window, args, kwargs)
	Gtk.main_quit()
Exemplo n.º 11
0
def cb_button_clicked(button, *args, **kwargs):
	print('cb_button_clicked:', button, args, kwargs)
	Gtk.main_quit()
Exemplo n.º 12
0
def main():
	MainWindow()
	Gtk.main()
Exemplo n.º 13
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()
Exemplo n.º 14
0
	def cb_button_clicked(self, button, *args, **kwargs):
		print('MainWindow.cb_button_clicked:', window, args, kwargs)
		Gtk.main_quit()
Exemplo n.º 15
0
	def cb_window_destroy(self, window, *args, **kwargs):
		print('MainWindow.cb_window_destroy:', window, args, kwargs)
		Gtk.main_quit()
Exemplo n.º 16
0
		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)
	
	def cb_window_delete_event(self, window, *args, **kwargs):
		print('MainWindow.cb_window_delete_event:', window, args, kwargs)
		return False
	
	def cb_window_destroy(self, window, *args, **kwargs):
		print('MainWindow.cb_window_destroy:', window, args, kwargs)
		Gtk.main_quit()
	
	def cb_button_clicked(self, button, *args, **kwargs):
		print('MainWindow.cb_button_clicked:', window, args, kwargs)
		Gtk.main_quit()

if __name__ == '__main__':
	window = MainWindow()
	Gtk.main()