File: ExampleDemo.py

package info (click to toggle)
python-pmw 0.6.2-0.1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 1,652 kB
  • ctags: 2,716
  • sloc: python: 10,720; makefile: 44; sh: 24
file content (35 lines) | stat: -rw-r--r-- 883 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
""" Demonstration of the Pmw EXAMPLE megawidget.
"""

if __name__ == '__main__':
    # Import Pmw from the sibling directory.
    import sys
    sys.path[:0] = ['../../..']

import Tkinter
import Pmw

class Demo:
    def __init__(self, parent):

	# Create and pack the EXAMPLEs.
	self.widget1 = Pmw.Counter(parent)
	self.widget1.setentry('1')
	self.widget1.pack()

	self.widget2 = Pmw.Counter(parent, increment = 10)
	self.widget2.setentry('100')
	self.widget2.pack()

######################################################################

# Create demo in root window for testing.
if __name__ == '__main__':
    root = Tkinter.Tk()
    Pmw.initialise(root, fontScheme = 'pmw1')
    root.title('Pmw EXAMPLE demonstration')

    exitButton = Tkinter.Button(root, text = 'Exit', command = root.destroy)
    exitButton.pack(side = 'bottom')
    widget = Demo(root)
    root.mainloop()