Skip to content

Commit a80af77

Browse files
daniellovellserhiy-storchaka
authored andcommitted
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.
1 parent 31368a4 commit a80af77

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Doc/library/tkinter.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ A Simple Hello World Program
205205
class Application(tk.Frame):
206206
def __init__(self, master=None):
207207
super().__init__(master)
208+
self.master = master
208209
self.pack()
209210
self.create_widgets()
210211

@@ -215,7 +216,7 @@ A Simple Hello World Program
215216
self.hi_there.pack(side="top")
216217

217218
self.quit = tk.Button(self, text="QUIT", fg="red",
218-
command=root.destroy)
219+
command=self.master.destroy)
219220
self.quit.pack(side="bottom")
220221

221222
def say_hi(self):

0 commit comments

Comments
 (0)