3 # this shows how to create a new window with a button in it that can create new windows
10 # there is no Tkinter interface to the dialog box. Making one would mean putting
11 # a few wrapper functions in the Tkinter.py file.
12 # even better is to put in a SUIT-like selection of commonly-used dialogs.
13 # the parameters to this call are as follows:
15 fred
= Toplevel() # a toplevel window that the dialog goes into
18 # this function returns the index of teh button chosen. In this case, 0 for "yes" and 1 for "no"
20 print self
.tk
.call("tk_dialog", # the command name
21 fred
, # the name of a toplevel window
22 "fred the dialog box", # the title on the window
23 "click on a choice", # the message to appear in the window
24 "info", # the bitmap (if any) to appear. If no bitmap is desired, pass ""
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 any X bitmap where fname is the path to the file
38 "0", # the index of the default button choice. hitting return selects this
39 "yes", "no") # all remaining parameters are the labels for the
40 # buttons that appear left to right in the dialog box
44 def createWidgets(self
):
45 self
.QUIT
= Button(self
, {'text': 'QUIT',
47 'command': self
.quit
})
49 self
.QUIT
.pack({'side': 'left', 'fill': 'both'})
53 self
.hi_there
= Button(self
, {'text': 'Make a New Window',
54 'command' : self
.makeWindow
})
55 self
.hi_there
.pack({'side': 'left'})
58 def __init__(self
, master
=None):
59 Frame
.__init
__(self
, master
)