我应该如何设置可扩展的 Gtk Notebook 页面选项卡?

How am I supposed to set a Gtk Notebook page tab expandable?

当我以编程方式将页面添加到 Gtk.Notebook 时,我找不到将选项卡设置为展开的方法。 属性 在 Glade 中可用,所以我知道它可以完成。这是使用 reorderabledetachable 属性的片段。

#!/usr/bin/env python

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

class GUI:
    def __init__(self):

        window = Gtk.Window()
        notebook = Gtk.Notebook()
        window.add(notebook)
        for i in range (4):
            label = Gtk.Label('label in page number ' + str(i))
            tab_label = Gtk.Label('page ' + str(i))
            notebook.append_page(label, tab_label)
            notebook.set_tab_detachable(label, True)
            notebook.set_tab_reorderable(label, True)
        window.show_all()
        window.connect('destroy', Gtk.main_quit)

app = GUI()
Gtk.main()

然而,

notebook.set_tab_expandable(label, True)

失败

AttributeError: 'Notebook' object has no attribute 'set_tab_expandable'

解决方法是:

notebook.child_set_property(label, 'tab-expand', True)