| 1 | title = 'Pmw.EXAMPLE demonstration' |
| 2 | |
| 3 | # Import Pmw from this directory tree. |
| 4 | import sys |
| 5 | sys.path[:0] = ['../../..'] |
| 6 | |
| 7 | import Tkinter |
| 8 | import Pmw |
| 9 | |
| 10 | class Demo: |
| 11 | def __init__(self, parent): |
| 12 | |
| 13 | # Create and pack the EXAMPLEs. |
| 14 | self.widget1 = Pmw.Counter(parent) |
| 15 | self.widget1.setentry('1') |
| 16 | self.widget1.pack() |
| 17 | |
| 18 | self.widget2 = Pmw.Counter(parent, increment = 10) |
| 19 | self.widget2.setentry('100') |
| 20 | self.widget2.pack() |
| 21 | |
| 22 | ###################################################################### |
| 23 | |
| 24 | # Create demo in root window for testing. |
| 25 | if __name__ == '__main__': |
| 26 | root = Tkinter.Tk() |
| 27 | Pmw.initialise(root) |
| 28 | root.title(title) |
| 29 | |
| 30 | exitButton = Tkinter.Button(root, text = 'Exit', command = root.destroy) |
| 31 | exitButton.pack(side = 'bottom') |
| 32 | widget = Demo(root) |
| 33 | root.mainloop() |