]> granicus.if.org Git - python/commitdiff
bpo-35086: Fix tkinter example "A Simple Hello World Program". (GH-10160)
authorDaniel Lovell <lovell.daniel92@gmail.com>
Tue, 30 Oct 2018 14:56:07 +0000 (07:56 -0700)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 30 Oct 2018 14:56:07 +0000 (16:56 +0200)
The root widget was accessed as a global variable in the Application's method.

Doc/library/tkinter.rst

index 4af4b7356e1ce3bcb3af13aa03f8a3a8f9a8cee0..60cf892e0888b718eceeb9e96f4801395fb3bf70 100644 (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):