Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / lib / python2.4 / site-packages / Pmw / Pmw_1_2 / demos / ComboBoxDialog.py
CommitLineData
86530b38
AT
1title = 'Pmw.ComboBoxDialog demonstration'
2
3# Import Pmw from this directory tree.
4import sys
5sys.path[:0] = ['../../..']
6
7import Tkinter
8import Pmw
9
10class Demo:
11 def __init__(self, parent):
12 # Create the dialog.
13 self.dialog = Pmw.ComboBoxDialog(parent,
14 title = 'My ComboBoxDialog',
15 buttons = ('OK', 'Cancel'),
16 defaultbutton = 'OK',
17 combobox_labelpos = 'n',
18 label_text = 'What do you think of Pmw?',
19 scrolledlist_items = ('Cool man', 'Cool', 'Good', 'Bad', 'Gross'))
20 self.dialog.withdraw()
21
22 # Create button to launch the dialog.
23 w = Tkinter.Button(parent,
24 text = 'Show combo box dialog',
25 command = self.doit)
26 w.pack(padx = 8, pady = 8)
27
28 def doit(self):
29 result = self.dialog.activate()
30 print 'You clicked on', result, self.dialog.get()
31
32######################################################################
33
34# Create demo in root window for testing.
35if __name__ == '__main__':
36 root = Tkinter.Tk()
37 Pmw.initialise(root)
38 root.title(title)
39
40 exitButton = Tkinter.Button(root, text = 'Exit', command = root.destroy)
41 exitButton.pack(side = 'bottom')
42 widget = Demo(root)
43 root.mainloop()
44