Patch #911176: Move test function into __main__

This commit is contained in:
Martin v. Löwis 2004-03-22 21:49:47 +00:00
parent 211a2eb784
commit a3837a0d63

View file

@ -86,10 +86,12 @@ def done(self, num):
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 doit(root=root):
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()