[Python-bugs-list] [ python-Bugs-564729 ] FixTk.py logic wrong

noreply@sourceforge.net noreply@sourceforge.net
Sat, 02 Nov 2002 21:06:25 -0800


Bugs item #564729, was opened at 2002-06-05 06:09
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=564729&group_id=5470

Category: Tkinter
Group: Python 2.1.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Internet Discovery (idiscovery)
Assigned to: Nobody/Anonymous (nobody)
Summary: FixTk.py logic wrong

Initial Comment:
The logic in FixTk.py is wrong for Tix: the Tix version number
is independent of the Tk/Tcl version number.

Just duplicate the Tcl code logic for Tix, and don't reuse the 
Tcl version number.



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

>Comment By: Internet Discovery (idiscovery)
Date: 2002-11-03 05:06

Message:
Logged In: YES 
user_id=33229

Sorry for the lack of detail: the logic is wrong because the version number
of Tix is assumed to be the same as the version number of Tcl in _tkinter.
Right now they are different (8.3 or 8.4 for Tcl and 8.1 for Tix) and in general
these days with stubs in Tcl, they are unrelated. Any Tix should work with any
Tcl after Tcl 8.1 or so. So the answer is to remove tix from the for loop, and just
copy the Tcl block of logic and change the tcl to tix as in the following (untested)

if not os.environ.has_key("TIX_LIBRARY"):
        for name in os.listdir(prefix):
            if name.startswith("tix"):
                tixdir = os.path.join(prefix,name)
                if os.path.isdir(tixdir):
                    os.environ["TIX_LIBRARY"] = tixdir
               del tixdir

Note that as it stands now there is a subtle difference between the logic for 
setting TCL_LIBRARY and for setting TK_LIBRARY (ignoring tix completely).
Imagine you have a Tcl directory with no environment variables and the following subdirs:
        tcl8.3 tcl8.4 tk8.3 tk8.4
If os.listddir returns the directories in alphabetical order I think you end up with
       TCL_LIBRARY=.../tcl8.4 (there's no break in the for name loop)
and TK_LIBRARY=.../tk8.3 if tk was compiled with tcl  8.3 (_tkinter.TCL_VERSION)
With Tk8.4 now finally released this a real potential scenario.
This may be good or bad - the attached file maintains it.

The discussion above and the attached file applies to all versions of Python,
so it should be tagged for any 2.x branch. I think the same is true for Tix.py.

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-06-10 19:25

Message:
Logged In: YES 
user_id=6380

Can you please supply a patch?

The code in 2.2 and later is different; is that still
broken?  If so, please supply two patches!

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

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