summaryrefslogtreecommitdiffstats
path: root/Lib/lib-tk/SimpleDialog.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2004-03-22 21:49:47 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2004-03-22 21:49:47 (GMT)
commita3837a0d6394f9299e9cf5b4c67fcc705ec548ed (patch)
tree32582ec32fd052cdaccb5aa6460b86c1b01c7712 /Lib/lib-tk/SimpleDialog.py
parent211a2eb784641fd062fe549cbc7ca5da7378e852 (diff)
downloadcpython-a3837a0d6394f9299e9cf5b4c67fcc705ec548ed.zip
cpython-a3837a0d6394f9299e9cf5b4c67fcc705ec548ed.tar.gz
cpython-a3837a0d6394f9299e9cf5b4c67fcc705ec548ed.tar.bz2
Patch #911176: Move test function into __main__
Diffstat (limited to 'Lib/lib-tk/SimpleDialog.py')
-rw-r--r--Lib/lib-tk/SimpleDialog.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/Lib/lib-tk/SimpleDialog.py b/Lib/lib-tk/SimpleDialog.py
index bbd6b9f..bb63a8d 100644
--- a/Lib/lib-tk/SimpleDialog.py
+++ b/Lib/lib-tk/SimpleDialog.py
@@ -86,10 +86,12 @@ class SimpleDialog:
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 @@ def test():
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()