#!/usr/bin/env python3 import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk class TextBox(Gtk.EventBox): def __init__(self, width, height): Gtk.EventBox.__init__(self) self.set_size_request(width, height) self.label = Gtk.Label() align = Gtk.Alignment(xalign=0.5, yalign=0.5) self.add(self.label) self.add(align) def set_text(self, string): self.label.set_text('孙晓 - 丹歌惊鸿')