File: notebook.py

package info (click to toggle)
python-gtk 0.5.3-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 1,604 kB
  • ctags: 4,295
  • sloc: ansic: 19,390; python: 8,220; makefile: 91; sh: 26
file content (63 lines) | stat: -rwxr-xr-x 1,144 bytes parent folder | download | duplicates (2)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python

from Gtkinter import *

def destroy(args):
	window.destroy()
	mainquit()


window = GtkWindow()
window.connect("destroy", destroy)
window.set_title('Notebook')
window.border_width(0)
window.set_usize(400, 400)

box1 = GtkVBox()
window.add(box1)
box1.show()

box2 = GtkVBox(spacing=10)
box2.border_width(10)
box1.pack_start(box2)
box2.show()

notebook = GtkNotebook()
notebook.set_tab_pos(POS_TOP)
box2.pack_start(notebook)
notebook.show()

names = ['Background', 'Colors', 'System', 'Setup', 'Samba']

for i in range(len(names)):
	buffer = names[i]
	frame = GtkFrame(buffer)
	frame.border_width(10)
	frame.set_usize(200, 300)
	frame.set_shadow_type(SHADOW_ETCHED_OUT)
	frame.show()
	
	label = GtkLabel(buffer)
	frame.add(label)
	label.show()

	label = GtkLabel(buffer)
	label.set_padding(2, 2)
	notebook.append_page(frame, label)

separator = GtkHSeparator()
box1.pack_start(separator)
separator.show()

box3 = GtkVBox(spacing=10)
box3.border_width(10)
box1.pack_start(box3)
box3.show()

button = GtkButton(label='close')
box3.pack_start(button)
button.connect('clicked', destroy)
button.show()

window.show()
mainloop()