Instead of adding gtk.Label when adding a new page to gtk.Notebook you need to create gtk.HBox that contains both gtk.Label and gtk.Button . More or less, something like this:
class Dash(gtk.Notebook): ... def defaultTab(self): self.append_page(tab.child,tab.header) ... class Tab(): def __init__(self): ... header = gtk.HBox() title_label = gtk.Label() image = gtk.Image() image.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU) close_button = gtk.Button() close_button.set_image(image) close_button.set_relief(gtk.RELIEF_NONE) self.connect(close_button, 'clicked', self.close_cb) header.pack_start(title_label, expand=True, fill=True, padding=0) header.pack_end(close_button, expand=False, fill=False, padding=0) header.show_all() self.header = header ...
It is simple to display a close button. To actually close a tab, you need to process the clicked signal with a button.
source share