I'm working through the GTK+3 tutorials, and all the examples I have worked through--as well as code I've written using code as well as glade--produce a window larger than necessary.
Does anyone have a suggestion for what I'm doing wrong, or how to go about fixing it?
Here's a simple example:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class MyWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title = 'Hello World')
self.box = Gtk.Box(spacing=6)
self.add(self.box)
self.button1 = Gtk.Button(label = 'Hello')
self.button1.connect('clicked', self.on_button1_clicked)
self.box.pack_start(self.button1, True, True, 0)
self.button2 = Gtk.Button(label = 'Goodbye')
self.button2.connect('clicked', self.on_button2_clicked)
self.box.pack_start(self.button2, True, True, 0)
def on_button1_clicked(self, widget):
print('Hello')
def on_button2_clicked(self, widget):
print('Goodbye')
win = MyWindow()
win.connect('delete-event', Gtk.main_quit)
win.show_all()
Gtk.main()
Here is what my code produces:
And here is what it is supposed to look like according to the tutorial