Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / lib / python2.4 / site-packages / Pmw / Pmw_1_2 / demos / ShowBusy.py
CommitLineData
920dae64
AT
1title = 'Blt busy cursor 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 self.parent = parent
13
14 if Pmw.Blt.havebltbusy(parent):
15 text = 'Click here to show the\nbusy cursor for one second.'
16 else:
17 text = 'Sorry\n' \
18 'Either the BLT package has not\n' \
19 'been installed on this system or\n' \
20 'it does not support the busy command.\n' \
21 'Clicking on this button will pause\n' \
22 'for one second but will not display\n' \
23 'the busy cursor.'
24
25 button = Tkinter.Button(parent,
26 text = text,
27 command = Pmw.busycallback(self.sleep, parent.update))
28 button.pack(padx = 10, pady = 10)
29
30 entry = Tkinter.Entry(parent, width = 30)
31 entry.insert('end', 'Try to enter some text while busy.')
32 entry.pack(padx = 10, pady = 10)
33
34 def sleep(self):
35 self.parent.after(1000)
36
37######################################################################
38
39# Create demo in root window for testing.
40if __name__ == '__main__':
41 root = Tkinter.Tk()
42 Pmw.initialise(root)
43 root.title(title)
44
45 exitButton = Tkinter.Button(root, text = 'Exit', command = root.destroy)
46 exitButton.pack(side = 'bottom')
47 widget = Demo(root)
48 root.mainloop()