mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
Patch #911176: Move test function into __main__
This commit is contained in:
parent
211a2eb784
commit
a3837a0d63
1 changed files with 12 additions and 12 deletions
|
@ -86,10 +86,12 @@ class SimpleDialog:
|
||||||
self.root.quit()
|
self.root.quit()
|
||||||
|
|
||||||
|
|
||||||
def test():
|
if __name__ == '__main__':
|
||||||
root = Tk()
|
|
||||||
def doit(root=root):
|
def test():
|
||||||
d = SimpleDialog(root,
|
root = Tk()
|
||||||
|
def doit(root=root):
|
||||||
|
d = SimpleDialog(root,
|
||||||
text="This is a test dialog. "
|
text="This is a test dialog. "
|
||||||
"Would this have been an actual dialog, "
|
"Would this have been an actual dialog, "
|
||||||
"the buttons below would have been glowing "
|
"the buttons below would have been glowing "
|
||||||
|
@ -99,13 +101,11 @@ def test():
|
||||||
default=0,
|
default=0,
|
||||||
cancel=2,
|
cancel=2,
|
||||||
title="Test Dialog")
|
title="Test Dialog")
|
||||||
print d.go()
|
print d.go()
|
||||||
t = Button(root, text='Test', command=doit)
|
t = Button(root, text='Test', command=doit)
|
||||||
t.pack()
|
t.pack()
|
||||||
q = Button(root, text='Quit', command=t.quit)
|
q = Button(root, text='Quit', command=t.quit)
|
||||||
q.pack()
|
q.pack()
|
||||||
t.mainloop()
|
t.mainloop()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
test()
|
test()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue