Pmw.CounterDialog() -
activate()
. The default is None.
If the value of command is not callable, the default behaviour
is to deactivate the window if it is active, or withdraw the
window if it is not active. If it is deactivated, deactivate()
is called with the button name or None as described above. The default is None.
deactivate()
. The default is None.
activate()
method to control whether the
window is made transient during modal dialogs. See the
activate()
method. The default is 'parent'.
(hull_borderwidth = 1, hull_relief = 'raised')
. By default, this component is a Pmw.ButtonBox.
(borderwidth = 1, relief = 'raised')
. By default, this component is a Tkinter.Frame.
class Demo: def __init__(self, parent): # Create the dialog to prompt for the number of times to ring the bell. self.dialog = Pmw.CounterDialog(parent, label_text = 'Enter the number of times to\n' + \ 'sound the bell (1 to 5)\n', counter_labelpos = 'n', entryfield_value = 2, counter_datatype = 'numeric', entryfield_validate = {'validator' : 'numeric', 'min' : 1, 'max' : 5}, buttons = ('OK', 'Cancel'), defaultbutton = 'OK', title = 'Bell ringing', command = self.execute) self.dialog.withdraw() # Create button to launch the dialog. w = Tkinter.Button(parent, text = 'Show counter dialog', command = self.dialog.activate) w.pack(padx = 8, pady = 8) def execute(self, result): if result is None or result == 'Cancel': print 'Bell ringing cancelled' self.dialog.deactivate() else: count = self.dialog.get() if not self.dialog.valid(): print 'Invalid entry: "' + count + '"' else: print 'Ringing the bell ' + count + ' times' for num in range(string.atoi(count)): if num != 0: self.dialog.after(200) self.dialog.bell() self.dialog.deactivate()
Home. Pmw 0.8.5 Maintainer gregm@iname.com. 9 Feb 2001