In python gtk docs for notebook widget, there is a mention of append_page which adds a page/tab to the notebook.
The second parameter in append_page is a widget which goes in the title of the page (inplace of the default Page 1), but when any other widget is provided it does not show anything.
Is it possible to add a a custom widget that has two child widgets like (Gtk.Label, Gtk.Button) to close specific tabs from the notebook when needed.
A custom widget implementation would be
class PageTitle(Gtk.Box):
def __init__(self):
super().__init__()
self.title = Gtk.Label("title")
self.close = Gtk.Button("close")
Again the goal is to have two widgets in the page title.
I tried passing an object of the class PageTitle but was not successful as this resulted in an empty page title
You did not add the childern widgets to the custom widget
PageTitleand you should callself.show_all()in__init__inPageTitleclass to show the label and button, here is another exampleThe code you want to use looks something like this