| 1 |
from Tkinter import * |
| 2 |
from Dialog import Dialog |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
class Test(Frame): |
| 8 |
def printit(self): |
| 9 |
print "hi" |
| 10 |
|
| 11 |
def makeWindow(self): |
| 12 |
"""Create a top-level dialog with some buttons. |
| 13 |
|
| 14 |
This uses the Dialog class, which is a wrapper around the Tcl/Tk |
| 15 |
tk_dialog script. The function returns 0 if the user clicks 'yes' |
| 16 |
or 1 if the user clicks 'no'. |
| 17 |
""" |
| 18 |
|
| 19 |
d = Dialog( |
| 20 |
self, |
| 21 |
title="fred the dialog box", |
| 22 |
text="click on a choice", |
| 23 |
bitmap="info", |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
default=0, |
| 39 |
|
| 40 |
strings=("yes", "no")) |
| 41 |
|
| 42 |
|
| 43 |
return d.num |
| 44 |
|
| 45 |
|
| 46 |
def createWidgets(self): |
| 47 |
self.QUIT = Button(self, text='QUIT', foreground='red', |
| 48 |
command=self.quit) |
| 49 |
self.QUIT.pack(side=LEFT, fill=BOTH) |
| 50 |
|
| 51 |
|
| 52 |
self.hi_there = Button(self, text='Make a New Window', |
| 53 |
command=self.makeWindow) |
| 54 |
self.hi_there.pack(side=LEFT) |
| 55 |
|
| 56 |
|
| 57 |
def __init__(self, master=None): |
| 58 |
Frame.__init__(self, master) |
| 59 |
Pack.config(self) |
| 60 |
self.windownum = 0 |
| 61 |
self.createWidgets() |
| 62 |
|
| 63 |
test = Test() |
| 64 |
test.mainloop() |