bpo-35086: Fix tkinter example "A Simple Hello World Program". (GH-10160)

The root widget was accessed as a global variable in the Application's method.
(cherry picked from commit a80af77087)

Co-authored-by: Daniel Lovell <lovell.daniel92@gmail.com>
This commit is contained in:
Miss Islington (bot) 2018-10-30 08:34:54 -07:00 committed by GitHub
parent 7d35f79012
commit f51ef51db6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -205,6 +205,7 @@ A Simple Hello World Program
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.create_widgets()
@ -215,7 +216,7 @@ A Simple Hello World Program
self.hi_there.pack(side="top")
self.quit = tk.Button(self, text="QUIT", fg="red",
command=root.destroy)
command=self.master.destroy)
self.quit.pack(side="bottom")
def say_hi(self):