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 / WidgetDestroy.py
CommitLineData
86530b38
AT
1title = 'Demonstration of Pmw megawidget destruction'
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 and pack an EntryField.
13 self.entryfield = Pmw.EntryField(parent,
14 command = self.execute,
15 value = 'Press <Return> to destroy me',
16 entry_width = 30)
17 self.entryfield.pack(fill='x', expand=1, padx=10, pady=5)
18
19 self.entryfield.component('entry').focus_set()
20
21 def execute(self):
22 print 'Return pressed, destroying EntryField.'
23 self.entryfield.destroy()
24
25######################################################################
26
27# Create demo in root window for testing.
28if __name__ == '__main__':
29 root = Tkinter.Tk()
30 Pmw.initialise(root)
31 root.title(title)
32
33 exitButton = Tkinter.Button(root, text = 'Exit', command = root.destroy)
34 exitButton.pack(side = 'bottom')
35 widget = Demo(root)
36 root.mainloop()