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

Serhiy Storchaka webhook-mailer at python.org
Tue Oct 30 10:56:13 EDT 2018


https://github.com/python/cpython/commit/a80af770870937271865b5e2b05a2cfe40b024b6
commit: a80af770870937271865b5e2b05a2cfe40b024b6
branch: master
author: Daniel Lovell <lovell.daniel92 at gmail.com>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2018-10-30T16:56:07+02:00
summary:

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.

files:
M Doc/library/tkinter.rst

diff --git a/Doc/library/tkinter.rst b/Doc/library/tkinter.rst
index 4af4b7356e1c..60cf892e0888 100644
--- a/Doc/library/tkinter.rst
+++ b/Doc/library/tkinter.rst
@@ -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):



More information about the Python-checkins mailing list