1 title = 'Test of the speed of creating Pmw megawidgets'
3 # Import Pmw from this directory tree.
5 sys.path[:0] = ['../../..']
12 def __init__(self, parent):
15 message = 'This is a test of the time\n' + \
16 'it takes to create 20 Pmw\nEntryField megawidgets.\n' + \
17 'Click on the button to create them.'
18 w = Tkinter.Label(parent, text = message)
19 w.pack(padx = 8, pady = 8)
21 # Create button to run speed test.
22 w = Tkinter.Button(parent,
23 text = 'Create 20 EntryFields',
24 command = self.createEntries)
25 w.pack(padx = 8, pady = 8)
27 def createEntries(self):
28 entryTop = Tkinter.Toplevel(self.parent)
30 startClock = time.clock()
33 field = Pmw.EntryField(entryTop,
35 label_text='*' + ('*' * num),
36 hull_background = 'lightsteelblue',
37 label_background = 'lightsteelblue',
38 hull_highlightbackground = 'lightsteelblue',
39 label_highlightbackground = 'lightsteelblue',
40 entry_highlightbackground = 'lightsteelblue',
41 entry_background = 'aliceblue')
45 Pmw.alignlabels(fields)
46 print 'Time to create 20 EntryFields:', \
47 time.clock() - startClock, 'seconds'
49 ######################################################################
51 # Create demo in root window for testing.
52 if __name__ == '__main__':
57 exitButton = Tkinter.Button(root, text = 'Exit', command = root.destroy)
58 exitButton.pack(side = 'bottom')