Gordon Airporte wrote: > The dialogs in tkColorChooser, tkFileDialog, etc. return useful values > from their creation somehow, so I can do stuff like this: > > filename = tkFileDialog.askopenfilename( master=self ) > > I would like to make a Yes/No/Cancel dialog that can be used the same > way (returning 1/0/-1), but I just cannot figure out how to do it. At > best I've been able to get some kind of instance id from the object. How > does this work?
if you want a message box, use the tkMessageBox module. there's no ready-made wrapper for yes/no/cancel, but you can call the _show directly: import tkMessageBox result = tkMessageBox._show( "title", "message", tkMessageBox.QUESTION, tkMessageBox.YESNOCANCEL ) result will be tkMessageBox.YES, tkMessageBox.NO, or tkMessageBox.CANCEL. if result == tkMessageBox.YES: return 1 if result == tkMessageNox.No: return 0 return -1 # assume cancel </F> -- http://mail.python.org/mailman/listinfo/python-list