[Patches] [ python-Patches-764217 ] Fix for tkFont.Font(name=...)

SourceForge.net noreply at sourceforge.net
Sat Sep 20 07:01:35 EDT 2003


Patches item #764217, was opened at 2003-07-01 23:14
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=764217&group_id=5470

Category: Tkinter
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Russell Owen (reowen)
Assigned to: Martin v. Löwis (loewis)
Summary: Fix for tkFont.Font(name=...)

Initial Comment:
tkFont.Font(name=xxx) crashes if a font by the specified name already exists. This is a problem for several reasons, the main one being that it makes life really tough if you want to creat a new tkFont.Font object for a given Tcl named font.



This simple fix handles the problem.



I've also included a new method __eq__ so that two tkFont.Font objects that point to the same Tcl named font compare as equal. I felt this is important because the fix makes it easier to have multiple such tkFont.Font objects.

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2003-09-20 13:01

Message:
Logged In: YES 
user_id=21627

reowen, are you willing to revise the patch in this direction?

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2003-07-13 17:57

Message:
Logged In: YES 
user_id=21627

While the bug might be worth fixing, I think the approach

taken is wrong. With the patch, it will invoke "font names"

for all new tkFont objects, which might be a significant

overhead.



To really preserve current behaviour, it should continue to

'font create', and fall back to 'font configure' in case of

an exception.



Actually, it is not clear what the right behaviour is in the

first place. 'font configure' would change the settings of

the existing font. If the name clash is by coincidence, it

would be better to raise an exception instead of silently

modifying the existing font.



In the face of ambiguity, refuse the temptation to guess.



So to really fix this, tkFont.forName (or tkFont.existing)

should be provided.

----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2003-07-13 17:32

Message:
Logged In: YES 
user_id=80475

The first part of the patch appears reasonable.  For the 

second part, it's a bit late for an API change.



Martin, is this bugfix okay for Py2.3?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=764217&group_id=5470



More information about the Patches mailing list