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: fix for #698517, Tkinter and tk8.4.2
Type: Stage:
Components: Tkinter Versions: Python 2.2
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: loewis Nosy List: chadn, doko, jmoore_calaway, loewis
Priority: high Keywords: patch

Created on 2003-03-21 19:36 by doko, last changed 2022-04-10 16:07 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Tkinter.py.diff doko, 2003-03-21 19:37
tkinter-alternate-patch doko, 2003-03-21 22:15
tkinter-alternate-patch doko, 2003-03-22 07:26
Messages (11)
msg43095 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2003-03-21 19:36
[all python version, that can be built with tk8.4.2]

Fixing the failing conversions in _substitute. Use
try/except for each integer field, that is not
supported by all events.
msg43096 - (view) Author: Chad Netzer (chadn) Date: 2003-03-21 20:59
Logged In: YES 
user_id=40145

Would it be better to simply define getint() as:

def getint( s ):
    try:
        return int( s )
    except ValueError:
        return s

Rather than add lots of try/excepts in the codebase?
I'm attaching an example diff (btw - I kept your field
explanations in the code; I liked them there)

These patches are important, BTW, since 8.4.1 has a few bugs
that would require other patches to Tkinter (returning ""
for getboolean for example, which seems to be fixed)
msg43097 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2003-03-21 21:14
Logged In: YES 
user_id=60903

I thought the whole thing to define getint = int was to do
local lookups only. Therefore the inlined try/excepts
msg43098 - (view) Author: Chad Netzer (chadn) Date: 2003-03-21 22:10
Logged In: YES 
user_id=40145

Hmmm, you are right.  Your approach will be quicker, due to
local namespace function lookup speed (try/except is fast in
non-exception path).

But, then again, a lot more exception paths will be executed
with the new Tk (with "??" fields), anyway, so the speed
issues may not be that important.
msg43099 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2003-03-21 22:15
Logged In: YES 
user_id=60903

Attach alternate patch by Chad
msg43100 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2003-03-22 07:26
Logged In: YES 
user_id=60903

Attach alternate patch by Chad
msg43101 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-03-23 12:07
Logged In: YES 
user_id=21627

What is the problem that this patch solves?
msg43102 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2003-03-23 13:35
Logged In: YES 
user_id=60903

> What is the problem that this patch solves?

As the subject says: Provide a patch for #698517.

tk8.4.2 returns for the undefined fields in events empty
strings or '??' strings, on which the int conversions fail.
msg43103 - (view) Author: Jeremy Moore (jmoore_calaway) Date: 2003-03-27 23:31
Logged In: YES 
user_id=744000

(Apologies if this is the inappropriate place to ask)
I'm porting an app to Mac OS X 10.2 (begrudgingly) and ran straight into 
this bug. Nothing like changing versions of python (2.2.2 to 2.3a2) and 
tcl/tk (8.3.4 to 8.4.2) while using a platform you're unfamiliar with! 
Anyway, I have successflly applied the patch; however, it has simply 
propagated the problem elsewhere. Specifically, the pmw rev 1.1 
widgets library. The problem is, pmw does additional processing that 
chokes on the '??' now returned by the try: excempt: statements. 

Perhaps, if anyone knows, it would be better to mimick what tcl/tk 8.3.x 
returned with the except statements. Pmw may not be the only library 
out there that will get choked up on this.

I will submit a bug in the pmw for this as well, but I'm looking for a least 
resistance path to get things up and running. (And not really wanting to 
rewite all my GUI constructon code...)

Thanks

Jeremy Moore
msg43104 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-03-27 23:58
Logged In: YES 
user_id=21627

Well, no. The Tk change was made for a reason, and it is
unlikely that Tk people will back it out, so we should not
bypass this change.

If you want to get up and running, I recommend to use Tcl 8.3.
msg43105 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-03-29 10:04
Logged In: YES 
user_id=21627

Thanks for the patch. Applied as Tkinter.py 1.170 and
1.160.10.3.
History
Date User Action Args
2022-04-10 16:07:49adminsetgithub: 38196
2003-03-21 19:36:39dokocreate