aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDaniel Lovell <lovell.daniel92@gmail.com>2018-10-30 07:56:07 -0700
committerSerhiy Storchaka <storchaka@gmail.com>2018-10-30 16:56:07 +0200
commita80af770870937271865b5e2b05a2cfe40b024b6 (patch)
tree851eff8c160a783ecd85c178c4addf6d7b6278bc
parent31368a4f0e531c19affe2a1becd25fc316bc7501 (diff)
downloadcpython-a80af770870937271865b5e2b05a2cfe40b024b6.tar.gz
cpython-a80af770870937271865b5e2b05a2cfe40b024b6.zip
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.
-rw-r--r--Doc/library/tkinter.rst3
1 files changed, 2 insertions, 1 deletions
diff --git a/Doc/library/tkinter.rst b/Doc/library/tkinter.rst
index 4af4b7356e1..60cf892e088 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):