-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
34 lines (27 loc) · 926 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import gtk
import sys;
class TestNotebook(gtk.Notebook):
def __init__(self):
gtk.Notebook.__init__(self)
def add_new_tab(self, icon):
image = gtk.Image()
image.set_from_stock(icon, gtk.ICON_SIZE_DIALOG)
image.show_all()
tab_image = gtk.Image()
tab_image.set_from_stock(icon, gtk.ICON_SIZE_MENU)
box = gtk.HBox()
box.pack_start(tab_image, False, False)
box.pack_start(gtk.Label(icon), True, True)
# set tab size here
box.set_size_request(50, 50)
box.show_all()
self.set_current_page(self.append_page(image))
self.set_tab_label(image, box)
if __name__ == '__main__':
notebook = TestNotebook()
notebook.add_new_tab(gtk.STOCK_ABOUT)
notebook.add_new_tab(gtk.STOCK_ADD)
notebook.add_new_tab(gtk.STOCK_APPLY)
box = gtk.VBox()
box.pack_start(notebook)
gtk.main()