diff Lib/lib-tk/SimpleDialog.py @ 31776:29be729b32c3 legacy-trunk

Patch #911176: Move test function into __main__
author Martin v. Löwis <martin@v.loewis.de>
date Mon, 22 Mar 2004 21:49:47 +0000
parents 9c37ed8868b9
children 22ded309648b
line wrap: on
line diff
--- a/Lib/lib-tk/SimpleDialog.py	Mon Mar 22 21:44:43 2004 +0000
+++ b/Lib/lib-tk/SimpleDialog.py	Mon Mar 22 21:49:47 2004 +0000
@@ -86,10 +86,12 @@
         self.root.quit()
 
 
-def test():
-    root = Tk()
-    def doit(root=root):
-        d = SimpleDialog(root,
+if __name__ == '__main__':
+
+    def test():
+        root = Tk()
+        def doit(root=root):
+            d = SimpleDialog(root,
                          text="This is a test dialog.  "
                               "Would this have been an actual dialog, "
                               "the buttons below would have been glowing "
@@ -99,13 +101,11 @@
                          default=0,
                          cancel=2,
                          title="Test Dialog")
-        print d.go()
-    t = Button(root, text='Test', command=doit)
-    t.pack()
-    q = Button(root, text='Quit', command=t.quit)
-    q.pack()
-    t.mainloop()
+            print d.go()
+        t = Button(root, text='Test', command=doit)
+        t.pack()
+        q = Button(root, text='Quit', command=t.quit)
+        q.pack()
+        t.mainloop()
 
-
-if __name__ == '__main__':
     test()