This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ScrolledText allows Frame.bbox to hide Text.bbox
Type: behavior Stage: test needed
Components: Tkinter Versions: Python 3.1, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: loewis Nosy List: drewp, gpolo, loewis
Priority: normal Keywords: patch

Created on 2005-02-09 22:22 by drewp, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue1119673.diff gpolo, 2009-04-22 21:20
Messages (5)
msg60650 - (view) Author: Drew Perttula (drewp) Date: 2005-02-09 22:22
sys.version ==  '2.3.3a0 (#3, Jul 20 2004, 10:32:48)
\n[GCC 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.2)]'

from ScrolledText import ScrolledText
s = ScrolledText()
s.pack()

I wish to call bbox on the Text, but s.bbox is the
surrounding Frame's bbox, and the Text's bbox method is
lost. I suppose these lines from ScrolledText.py should
be expanded to include 'bbox', but I have not tested
such a fix:

            if m[0] != '_' and m != 'config' and m !=
'configure':
                setattr(self, m, getattr(self.frame, m))

For special situations (of which bbox is probably *not*
one), the Text methods should probably be available
under something like s.text.bbox().
msg60651 - (view) Author: Drew Perttula (drewp) Date: 2005-02-09 22:36
Logged In: YES 
user_id=127598

A workaround:

s = ScrolledText()
new.instancemethod(Text.bbox,s,s.__class__)(...)

but, I actually have a subclass of ScrolledText, and I can't
figure out how to use the workaround. 

class Foo(ScrolledText):
...  def foo(self):   
... ... new.instancemethod(tk.Text.bbox, self,
self.__class__)("insert")

TypeError: unbound method bbox() must be called with Text
instance as first argument (got Foo instance instead)
msg86336 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-04-22 21:20
> I suppose these lines from ScrolledText.py should
> be expanded to include 'bbox', but I have not tested
> such a fix:
>
>            if m[0] != '_' and m != 'config' and m != 'configure':
>                setattr(self, m, getattr(self.frame, m))

bbox is already there, that is the problem. Including it again there
doesn't solve your problem. The actual problem is that Grid methods
include the "bbox" as an alias to the Misc.grid_bbox method.

One way to fix this is setting only the attributes that are not present
in the Text class. The attached patch does that.
msg91687 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-08-18 13:23
This has been fixed on r74507 now.
msg91701 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-08-18 15:36
> This has been fixed on r74507 now.

py3k branch: r74518.
History
Date User Action Args
2022-04-11 14:56:09adminsetgithub: 41557
2009-08-18 15:36:49gpolosetmessages: + msg91701
2009-08-18 15:36:44gpolosetresolution: accepted -> fixed
2009-08-18 13:23:32gpolosetstatus: open -> closed
resolution: accepted
messages: + msg91687
2009-04-22 21:20:20gpolosetfiles: + issue1119673.diff
versions: + Python 3.1, Python 2.7, - Python 2.6
nosy: + gpolo

messages: + msg86336

keywords: + patch
2009-02-16 01:01:04ajaksu2setstage: test needed
type: behavior
versions: + Python 2.6, - Python 2.3
2005-02-09 22:22:56drewpcreate