summaryrefslogtreecommitdiffstats
path: root/Lib/lib-tk/tkSimpleDialog.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/lib-tk/tkSimpleDialog.py')
-rw-r--r--Lib/lib-tk/tkSimpleDialog.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/Lib/lib-tk/tkSimpleDialog.py b/Lib/lib-tk/tkSimpleDialog.py
index 7b70411..3411d94 100644
--- a/Lib/lib-tk/tkSimpleDialog.py
+++ b/Lib/lib-tk/tkSimpleDialog.py
@@ -46,8 +46,13 @@ class Dialog(Toplevel):
title -- the dialog title
'''
Toplevel.__init__(self, parent)
- self.transient(parent)
+ # If the master is not viewable, don't
+ # make the child transient, or else it
+ # would be opened withdrawn
+ if parent.winfo_viewable():
+ self.transient(parent)
+
if title:
self.title(title)
@@ -124,9 +129,10 @@ class Dialog(Toplevel):
self.withdraw()
self.update_idletasks()
- self.apply()
-
- self.cancel()
+ try:
+ self.apply()
+ finally:
+ self.cancel()
def cancel(self, event=None):