from gi.repository import Gtk



button1 = Gtk.Button(label='Gtk')
button1.show()

button2 = Gtk.Button(label='Box')
button2.show()

box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
box.add(button1)
box.add(button2)
box.show()

box.get_style_context().add_class(Gtk.STYLE_CLASS_LINKED)

button3 = Gtk.Button(label='Gtk')
button3.show()

button4 = Gtk.Button(label='Grid')
button4.show()

inner_grid = Gtk.Grid()
inner_grid.add(button3)
inner_grid.add(button4)
inner_grid.show()

inner_grid.get_style_context().add_class(Gtk.STYLE_CLASS_LINKED)

outer_grid = Gtk.Grid()
outer_grid.set_border_width(50)
outer_grid.set_orientation(Gtk.Orientation.VERTICAL)
outer_grid.set_row_spacing(50)
outer_grid.add(box)
outer_grid.add(inner_grid)
outer_grid.show()

window = Gtk.Window(type=Gtk.WindowType.TOPLEVEL)
window.set_resizable(False)
window.connect('delete-event', lambda widget, event: Gtk.main_quit())
window.add(outer_grid)
window.show()

Gtk.main()
