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 / TimeCounter.py
CommitLineData
86530b38
AT
1title = 'Pmw.TimeCounter demonstration'
2
3# Import Pmw from this directory tree.
4import sys
5sys.path[:0] = ['../../..']
6
7import string
8import Tkinter
9import Pmw
10
11class Demo:
12 def __init__(self, parent):
13 self._time = Pmw.TimeCounter(parent,
14 labelpos = 'w',
15 label_text = 'HH:MM:SS',
16 min = '00:00:00',
17 max = '23:59:59')
18 self._time.pack(padx=10, pady=5)
19
20 button = Tkinter.Button(parent, text = 'Show', command = self.show)
21 button.pack()
22
23 def show(self):
24 stringVal = self._time.getstring()
25 intVal = self._time.getint()
26 print stringVal + ' (' + str(intVal) + ')'
27
28
29######################################################################
30
31# Create demo in root window for testing.
32if __name__ == '__main__':
33 root = Tkinter.Tk()
34 Pmw.initialise(root)
35 root.title(title)
36
37 exitButton = Tkinter.Button(root, text = 'Exit', command = root.destroy)
38 exitButton.pack(side = 'bottom')
39 widget = Demo(root)
40 root.mainloop()