Files
Phoenix/docs/sphinx/rest_substitutions/snippets/python/converted/wx.Dialog.2.py
2016-09-30 20:01:54 -07:00

12 lines
507 B
Python

# Things can be made a little simpler in Python by using the dialog as a
# context manager, using the with statement, like this:
def AskUser(self):
with MyAskDialog(self) as dlg:
if dlg.ShowModal() == wx.ID_OK:
# do something here
print('Hello')
else:
# handle dialog being cancelled or ended by some other button
...
# The dialog is automatically destroyed on exit from the context manager