Skip to content

Commit 780d5e0

Browse files
committed
#10768: fix ScrolledText widget construction, and make the example work from the interactive shell.
1 parent 90b2067 commit 780d5e0

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

Lib/tkinter/scrolledtext.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def __init__(self, master=None, **kw):
3030
# Copy geometry methods of self.frame without overriding Text
3131
# methods -- hack!
3232
text_meths = vars(Text).keys()
33-
methods = vars(Pack).keys() + vars(Grid).keys() + vars(Place).keys()
34-
methods = set(methods).difference(text_meths)
33+
methods = vars(Pack).keys() | vars(Grid).keys() | vars(Place).keys()
34+
methods = methods.difference(text_meths)
3535

3636
for m in methods:
3737
if m[0] != '_' and m != 'config' and m != 'configure':
@@ -42,11 +42,10 @@ def __str__(self):
4242

4343

4444
def example():
45-
import __main__
4645
from tkinter.constants import END
4746

4847
stext = ScrolledText(bg='white', height=10)
49-
stext.insert(END, __main__.__doc__)
48+
stext.insert(END, __doc__)
5049
stext.pack(fill=BOTH, side=LEFT, expand=True)
5150
stext.focus_set()
5251
stext.mainloop()

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Core and Builtins
1818
Library
1919
-------
2020

21+
- Issue #10768: Make the Tkinter ScrolledText widget work again.
22+
2123
- Issue #10777: Fix "dictionary changed size during iteration" bug in
2224
ElementTree register_namespace().
2325

0 commit comments

Comments
 (0)