import gi

gi.require_version('Gtk', '3.0')

from gi.repository import Gtk

def create_box():
    box = Gtk.Box()
    left = Gtk.Button(label='left', halign=Gtk.Align.END)
    right = Gtk.Button(label='right right right', halign=Gtk.Align.START)
    label = Gtk.Label(label='hi there duder')

    box.pack_start(left, True, True, 0)
    box.pack_end(right, True, True, 0)
    box.set_center_widget(label)

    return box

win = Gtk.Window()
header = Gtk.HeaderBar()
header.set_custom_title(create_box())
win.set_titlebar(header)
win.add(create_box())

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

Gtk.main()

