I'm trying to vertically center the text of a label inside a box. This is do code I'm trying:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk
win = Gtk.Window()
win.set_default_size(200, 100)
box = Gtk.Box()
win.add(box)
lbl = Gtk.Label("FOO")
lbl.set_vexpand(True)
lbl.set_valign(Gtk.Align.CENTER)
# Set the background to make the problem visible
lbl.override_background_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(red=1, green=0, blue=0))
box.add(lbl)
win.show_all()
win.connect('destroy', Gtk.main_quit)
Gtk.main()
As you can see, the label itself is centered perfectly fine inside the box, but the text inside the label is shifted slightly towards the top end of the label:
I'm not able to find anything about this. Programmatic as well as CSS-based solutions are highly appreciated.