mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-09 05:20:08 +01:00
12 lines
507 B
Python
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 |