[issue9899] tkinter test_font fails on OS X with Aqua Tk

Ned Deily report at bugs.python.org
Tue Oct 5 07:04:43 CEST 2010


Ned Deily <nad at acm.org> added the comment:

After further investigation, on OS X at least, there is a difference in behavior between Tk 8.4 (the system default on OS X 10.4 and 10.5) and Tk 8.5 (the default on 10.6).  Lib/tkinter/font.py calls the Tk "font names" commands to check whether a font is already defined.  At the point where test_font.py is initially run, there has not been any real Tk activity yet.  For some reason, with 8.5 the system font names are returned; with 8.4 they are not:

$ /usr/bin/wish8.4
% font names
$ /usr/bin/wish8.5
% font names
systemPushButtonFont systemMenuItemFont systemApplicationFont systemSystemFont systemMenuItemMarkFont TkMenuFont TkDefaultFont systemSmallEmphasizedSystemFont systemDetailEmphasizedSystemFont systemMiniSystemFont TkHeadingFont TkTooltipFont systemUtilityWindowTitleFont systemViewsFont systemSmallSystemFont systemMenuTitleFont systemEmphasizedSystemFont TkTextFont systemDetailSystemFont TkCaptionFont systemLabelFont systemAlertHeaderFont systemMenuItemCmdKeyFont TkSmallCaptionFont TkFixedFont systemWindowTitleFont systemToolbarFont TkIconFont

So, a solution for that is to add a try block in test_font.py to create a font definition for TkDefaultFont if it does not already exist.  (Presumably, after the test failed and before it was re-run, other tests ran which caused the fonts to be defined so it passes.)  This time I have tested it with both Tk 8.4 and 8.5 on OS X 10.5 and 10.6.  Additional patch file attached (to be applied on top of the already applied first patch).

----------
assignee: ned.deily -> 
resolution: fixed -> accepted
stage: committed/rejected -> patch review
Added file: http://bugs.python.org/file19130/issue9899-fix1-py3k.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9899>
_______________________________________


More information about the Python-bugs-list mailing list