Skip to content

Commit 5433db2

Browse files
author
Ankit Chandawala
committed
Fix example in tkinter documentation
1 parent ab72fde commit 5433db2

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Doc/library/tkinter.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,16 +542,18 @@ the variable, with no further intervention on your part.
542542

543543
For example::
544544

545-
class App(Frame):
545+
import tkinter as tk
546+
547+
class App(tk.Frame):
546548
def __init__(self, master=None):
547549
super().__init__(master)
548550
self.pack()
549551

550-
self.entrythingy = Entry()
552+
self.entrythingy = tk.Entry()
551553
self.entrythingy.pack()
552554

553555
# here is the application variable
554-
self.contents = StringVar()
556+
self.contents = tk.StringVar()
555557
# set it to some value
556558
self.contents.set("this is a variable")
557559
# tell the entry widget to watch this variable
@@ -567,6 +569,8 @@ For example::
567569
print("hi. contents of entry is now ---->",
568570
self.contents.get())
569571

572+
myapp = App()
573+
myapp.mainloop()
570574

571575
The Window Manager
572576
^^^^^^^^^^^^^^^^^^
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix example in tkinter documentation

0 commit comments

Comments
 (0)