#!/usr/bin/env python3

from gi.repository import Gtk

win = Gtk.Window()
header = Gtk.HeaderBar()
center = Gtk.Box()
label = Gtk.Label(label='this is a label')
button = Gtk.Button(label='a longer label')
button2 = Gtk.Button()

win.set_titlebar(header)
header.set_custom_title(center)
center.pack_start(button2, False, True, 0)
center.pack_end(button, False, True, 0)
center.set_center_widget(label)

win.show_all()
win.present()
win.connect('delete-event', lambda *_: Gtk.main_quit())

Gtk.main()
