Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | title = 'Pmw.TextDialog 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 | # Create the dialog. | |
13 | dialog = Pmw.TextDialog(parent, scrolledtext_labelpos = 'n', | |
14 | title = 'My TextDialog', | |
15 | defaultbutton = 0, | |
16 | label_text = 'Lawyer jokes') | |
17 | dialog.withdraw() | |
18 | dialog.insert('end', jokes) | |
19 | dialog.configure(text_state = 'disabled') | |
20 | ||
21 | # Create button to launch the dialog. | |
22 | w = Tkinter.Button(parent, text = 'Show text dialog', | |
23 | command = dialog.activate) | |
24 | w.pack(padx = 8, pady = 8) | |
25 | ||
26 | jokes = """ | |
27 | Q: What do you call 5000 dead lawyers at the bottom of the ocean? | |
28 | A: A good start! | |
29 | ||
30 | Q: How can you tell when a lawyer is lying? | |
31 | A: His lips are moving. | |
32 | ||
33 | Q: Why won't sharks attack lawyers? | |
34 | A: Professional courtesy. | |
35 | ||
36 | Q: What do have when a lawyer is buried up to his neck in sand? | |
37 | A: Not enough sand. | |
38 | ||
39 | Q: How do you get a lawyer out of a tree? | |
40 | A: Cut the rope. | |
41 | ||
42 | Q: What is the definition of a shame (as in "that's a shame")? | |
43 | A: When a bus load of lawyers goes off a cliff. | |
44 | ||
45 | Q: What is the definition of a "crying shame"? | |
46 | A: There was an empty seat. | |
47 | ||
48 | Q: What do you get when you cross the Godfather with a lawyer? | |
49 | A: An offer you can't understand. | |
50 | ||
51 | Q. What do lawyers use as contraceptives? | |
52 | A. Their personalities. | |
53 | ||
54 | Q. What's brown and black and looks good on a lawyer? | |
55 | A. A doberman. | |
56 | ||
57 | Q. Why are lawyers buried 12 feet underground? | |
58 | A. Deep down their good. | |
59 | ||
60 | Q. What's the difference between a catfish and a lawyer? | |
61 | A. One's a slimy scum-sucking scavenger, the other is just a fish. | |
62 | ||
63 | """ | |
64 | ###################################################################### | |
65 | ||
66 | # Create demo in root window for testing. | |
67 | if __name__ == '__main__': | |
68 | root = Tkinter.Tk() | |
69 | Pmw.initialise(root) | |
70 | root.title(title) | |
71 | ||
72 | exitButton = Tkinter.Button(root, text = 'Exit', command = root.destroy) | |
73 | exitButton.pack(side = 'bottom') | |
74 | widget = Demo(root) | |
75 | root.mainloop() |