Paul Rubin wrote: > Oh, I see. You really want something like repeat...while, which Python > doesn't have. Anyway I start to prefer something like (untested): > > def create_db_name(self): > try: > while True: > dlg = wx.TextEntryDialog(self.frame, 'Enter a database name:', > 'Create New Database') > if dlg.ShowModal() != wx.ID_OK: > return None > db_name = dlg.GetValue() > if db_name: > return db_name > pop_up_error_dialog("please enter a value or press cancel") > finally: > dlg.Destroy()
Interesting. Some variation of this might suit me, but I think one other problem I'm having is that the ShowModal() method returns whenever a button is pressed, so even if OK is pressed with an empty string in the box, the dialog disappears and returns an "OK" value. I'll have to check in the wxpython group on how to handle this one, I think. -- http://mail.python.org/mailman/listinfo/python-list