Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | title = 'Pmw.NoteBook demonstration' |
2 | ||
3 | # Import Pmw from this directory tree. | |
4 | import sys | |
5 | sys.path[:0] = ['../../..'] | |
6 | ||
7 | import Tkinter | |
8 | import Pmw | |
9 | ||
10 | class Demo: | |
11 | def __init__(self, parent): | |
12 | # Create and pack the NoteBook. | |
13 | notebook = Pmw.NoteBook(parent) | |
14 | notebook.pack(fill = 'both', expand = 1, padx = 10, pady = 10) | |
15 | ||
16 | # Add the "Appearance" page to the notebook. | |
17 | page = notebook.add('Appearance') | |
18 | notebook.tab('Appearance').focus_set() | |
19 | ||
20 | # Create the "Toolbar" contents of the page. | |
21 | group = Pmw.Group(page, tag_text = 'Toolbar') | |
22 | group.pack(fill = 'both', expand = 1, padx = 10, pady = 10) | |
23 | b1 = Tkinter.Checkbutton(group.interior(), text = 'Show toolbar') | |
24 | b1.grid(row = 0, column = 0) | |
25 | b2 = Tkinter.Checkbutton(group.interior(), text = 'Toolbar tips') | |
26 | b2.grid(row = 0, column = 1) | |
27 | ||
28 | # Create the "Startup" contents of the page. | |
29 | group = Pmw.Group(page, tag_text = 'Startup') | |
30 | group.pack(fill = 'both', expand = 1, padx = 10, pady = 10) | |
31 | home = Pmw.EntryField(group.interior(), labelpos = 'w', | |
32 | label_text = 'Home page location:') | |
33 | home.pack(fill = 'x', padx = 20, pady = 10) | |
34 | ||
35 | # Add two more empty pages. | |
36 | page = notebook.add('Helpers') | |
37 | page = notebook.add('Images') | |
38 | ||
39 | notebook.setnaturalsize() | |
40 | ||
41 | ###################################################################### | |
42 | ||
43 | # Create demo in root window for testing. | |
44 | if __name__ == '__main__': | |
45 | root = Tkinter.Tk() | |
46 | Pmw.initialise(root) | |
47 | root.title(title) | |
48 | ||
49 | widget = Demo(root) | |
50 | exitButton = Tkinter.Button(root, text = 'Exit', command = root.destroy) | |
51 | exitButton.pack() | |
52 | root.mainloop() |