diff options
author | Guido van Rossum <guido@python.org> | 2001-12-10 16:42:43 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-12-10 16:42:43 (GMT) |
commit | 61d3637ff8616d3e231a20f8f0da3237e27ca40c (patch) | |
tree | 0d7032f8e1eca5ebd94c3f6ff561aa7bca46e6ff | |
parent | fb173cd471e842dc37f01e767dd1fe0a9a5f7d4e (diff) | |
download | cpython-61d3637ff8616d3e231a20f8f0da3237e27ca40c.zip cpython-61d3637ff8616d3e231a20f8f0da3237e27ca40c.tar.gz cpython-61d3637ff8616d3e231a20f8f0da3237e27ca40c.tar.bz2 |
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.
-rw-r--r-- | Lib/lib-tk/ScrolledText.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/lib-tk/ScrolledText.py b/Lib/lib-tk/ScrolledText.py index 866da3a..5d92734 100644 --- a/Lib/lib-tk/ScrolledText.py +++ b/Lib/lib-tk/ScrolledText.py @@ -33,7 +33,11 @@ class ScrolledText(Text): self['yscrollcommand'] = self.vbar.set self.vbar['command'] = self.yview - # Copy Pack methods of self.frame -- hack! - for m in Pack.__dict__.keys(): + # Copy geometry methods of self.frame -- hack! + methods = Pack.__dict__.keys() + methods = methods + Grid.__dict__.keys() + methods = methods + Place.__dict__.keys() + + for m in methods: if m[0] != '_' and m != 'config' and m != 'configure': setattr(self, m, getattr(self.frame, m)) |