2 from Dialog
import Dialog
4 # this shows how to create a new window with a button in it
5 # that can create new windows
12 """Create a top-level dialog with some buttons.
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'.
18 # the parameters to this call are as follows:
20 self
, ## name of a toplevel window
21 title
="fred the dialog box",## title on the window
22 text
="click on a choice", ## message to appear in window
23 bitmap
="info", ## bitmap (if any) to appear;
25 # legal values here are:
26 # string what it looks like
27 # ----------------------------------------------
28 # error a circle with a slash through it
30 # grey50 darker grey square
31 # hourglass use for "wait.."
32 # info a large, lower case "i"
33 # questhead a human head with a "?" in it
34 # question a large "?"
36 # @fname X bitmap where fname is the path to the file
38 default
=0, # the index of the default button choice.
39 # hitting return selects this
40 strings
=("yes", "no"))
41 # values of the 'strings' key are the labels for the
42 # buttons that appear left to right in the dialog box
46 def createWidgets(self
):
47 self
.QUIT
= Button(self
, text
='QUIT', foreground
='red',
49 self
.QUIT
.pack(side
=LEFT
, fill
=BOTH
)
52 self
.hi_there
= Button(self
, text
='Make a New Window',
53 command
=self
.makeWindow
)
54 self
.hi_there
.pack(side
=LEFT
)
57 def __init__(self
, master
=None):
58 Frame
.__init
__(self
, master
)