Changing TK

Eric Brunel eric.brunel at pragmadev.com
Mon Jun 3 14:08:21 EDT 2002


Salim Zayat wrote:
> Hey all.  I have a quick question about something.  If I were to install
> a newer version of Tcl/Tk on my computer, would Tkinter.py recoginze it
> automatically, or do I need to tweak the Tkinter.py code itself?

On what kind of platform are you? Things will be a lot different if you're 
on Unix or Windows...

In fact, if your tcl/tk installation changes, there's two things that must 
be taken into account: the dynamic libraries used at run-time, and the 
tcl/tk API header files used when compiling the Python interpreter. 
However, both are not referenced at all in Tkinter.py, so "tweaking" it 
would not be of any help... When you get a new tcl/tk installation, you 
*must* recompile the interpreter, or you won't ever see any change.

If you're on Windows, you probably didn't compile your interpreter 
yourself. If you want to do it, you'll have to download the interpreter's 
sources. I can't help you any further here, since I didn't ever compile an 
interpreter on Windows. You'll have to reference your new tcl/tk 
installation somewhere, but I don't know how it can be done.

On Unix, you should already have the interpreter's sources. So go to the 
subdirectory "Modules" of your Python installation directory, edit the file 
named "Setup", change the part for the "_tkinter" module to reference the 
new location for your tcl/tk installation, recompile the interpreter and 
voila!

But DON'T EVER replace former tcl/tk libraries by newer ones without 
recompiling, even if they have the same name! It *may* work, but if it 
doesn't, the tk support in your Python will be completely and definitely 
broken...

HTH
-- 
- Eric Brunel <eric.brunel at pragmadev.com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com



More information about the Python-list mailing list