Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | title = 'Colorscheme 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 | frame = Tkinter.Frame(parent) | |
13 | frame.pack(fill = 'both', expand = 1) | |
14 | ||
15 | defaultPalette = Pmw.Color.getdefaultpalette(parent) | |
16 | ||
17 | colors = ('red', 'green', 'blue') | |
18 | items = ('Testing', 'More testing', 'a test', 'foo', 'blah') | |
19 | for count in range(len(colors)): | |
20 | color = colors[count] | |
21 | normalcolor = Pmw.Color.changebrightness(parent, color, 0.85) | |
22 | Pmw.Color.setscheme(parent, normalcolor) | |
23 | combo = Pmw.ComboBox(frame, | |
24 | scrolledlist_items = items, | |
25 | entryfield_value = items[0]) | |
26 | combo.grid(sticky='nsew', row = count, column = 0) | |
27 | ||
28 | normalcolor = Pmw.Color.changebrightness(parent, color, 0.35) | |
29 | Pmw.Color.setscheme(parent, normalcolor, foreground = 'white') | |
30 | combo = Pmw.ComboBox(frame, | |
31 | scrolledlist_items = items, | |
32 | entryfield_value = items[0]) | |
33 | combo.grid(sticky='nsew', row = count, column = 1) | |
34 | ||
35 | apply(Pmw.Color.setscheme, (parent,), defaultPalette) | |
36 | #normalcolor = Pmw.Color.changebrightness(parent, 'red', 0.85) | |
37 | #Pmw.Color.setscheme(parent, normalcolor) | |
38 | ||
39 | ###################################################################### | |
40 | ||
41 | # Create demo in root window for testing. | |
42 | if __name__ == '__main__': | |
43 | root = Tkinter.Tk() | |
44 | Pmw.initialise(root) | |
45 | root.title(title) | |
46 | ||
47 | exitButton = Tkinter.Button(root, text = 'Exit', command = root.destroy) | |
48 | exitButton.pack(side = 'bottom') | |
49 | widget = Demo(root) | |
50 | root.mainloop() |