Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 61d3637

Browse files
committed
SF patch #491183 (Jeff Epler): ScrolledText.grid() doesn't work
Using grid methods on ScrolledText widgets does not work as expected. It either fails to pack a widget, or can even cause Tk to lock up. The problem is that the .grid method is being called on the text widget, not the frame widget. This can lead to the well-known lockup in Tk when a frame's children are managed by both the pack and grid managers. Even if it doesn't lock up, the frame is never placed within the intended widget. Program fragment: >>> import ScrolledText >>> s = ScrolledText.ScrolledText() >>> s.grid(row=0, column=0, rowspan=2) The following patch uses the same hack to copy the 'grid' and 'place' geometry manager methods to the ScrolledText instance as is already used for the 'pack' manager.
1 parent fb173cd commit 61d3637

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Lib/lib-tk/ScrolledText.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ def __init__(self, master=None, cnf=None, **kw):
3333
self['yscrollcommand'] = self.vbar.set
3434
self.vbar['command'] = self.yview
3535

36-
# Copy Pack methods of self.frame -- hack!
37-
for m in Pack.__dict__.keys():
36+
# Copy geometry methods of self.frame -- hack!
37+
methods = Pack.__dict__.keys()
38+
methods = methods + Grid.__dict__.keys()
39+
methods = methods + Place.__dict__.keys()
40+
41+
for m in methods:
3842
if m[0] != '_' and m != 'config' and m != 'configure':
3943
setattr(self, m, getattr(self.frame, m))

0 commit comments

Comments
 (0)