PIL & Tk8.2

Fred Fubar fred at fubar.com
Sat Feb 12 15:26:10 EST 2000


The big issue is not PIL by _tkinter. Here are my instructions for building
Tk8.2 compatible PIL (on NT 4.0 system with VC++ 6.0):

1) You need to generate a makefile or VC project file, since F.L. uses other
means. My recommendation is to get Ken Seehof's PyExtWizard
(http://starship.python.net/crew/seehof/PyExtWizard.html) and generate an
empty project called "PIL". Then delete the stdafx.* and PIL.cpp files from
this project and instead, add all the requisite files from the PIL 1.0
release (all *.c and *.h except coretest.c and except.c, as per the
instructions in the PIL release)

2) Edit the project settings (C++/Preprocessor/Include Directories) to put
the tcl/tk 8.2 include directory in the include search path.

3) Build PIL

Now you also have to build an 8.2 compatible version of _tkinter.pyd.

1) Go to the Python anonymous CVS repository (see
http://www.python.org/download/cvs.html for instructions) and look at the
post "r152" modifications to python/dist/src/Modules/_tkinter.c (revision
1.89 vc. 1.88) and tkappinit.c (rev. 1.7 vs. 1.6), which incorporate Dieter
Maurer's patches for tcl/tk 8.1 and 8.2 functionality). On Windows NT, the
comments in _tkinter.c, that the patch does not work on Tcl/Tk 8.2 seems to
be incorrect, so you want to change the line 491 from

#if TKMAJORMINOR == 8001

to

#if TKMAJORMINOR >= 8001

On other systems, YMMV.

2) Apply this patch to FixTk.py:

*** FixTk.py Fri Feb 04 03:30:58 2000
--- \FixTk.py Mon Jan 04 18:06:44 1999
***************
*** 1,4 ****
! """Utility which tries to locate the Tcl/Tk 8.x DLLs on Windows.

  This is a no-op on other platforms.
  """
--- 1,4 ----
! """Utility which tries to locate the Tcl/Tk 8.0 DLLs on Windows.

  This is a no-op on other platforms.
  """
***************
*** 6,13 ****
  # Error messages we may spit out

  NO_TCL_MESSAGE = """\
! WHOOPS!  I can't find a Tcl/Tk 8.x installation anywhere.
! Please make sure that Tcl.Tk 8.x is installed and that the PATH
  environment variable is set to include the Tcl/bin directory
  (or wherever TK80.DLL and TCL80.DLL are installed).
  If you don't know how to fix this, consider searching the Python FAQ
--- 6,13 ----
  # Error messages we may spit out

  NO_TCL_MESSAGE = """\
! WHOOPS!  I can't find a Tcl/Tk 8.0 installation anywhere.
! Please make sure that Tcl.Tk 8.0 is installed and that the PATH
  environment variable is set to include the Tcl/bin directory
  (or wherever TK80.DLL and TCL80.DLL are installed).
  If you don't know how to fix this, consider searching the Python FAQ
***************
*** 16,22 ****
  """

  NO_TKINTER_MESSAGE = """\
! WHOOPS!  Even though I think I have found a Tcl/Tk 8.x installation,
  I can't seem to import the _tkinter extension module.
  I get the following exception:
      ImportError: %s
--- 16,22 ----
  """

  NO_TKINTER_MESSAGE = """\
! WHOOPS!  Even though I think I have found a Tcl/Tk 8.0 installation,
  I can't seem to import the _tkinter extension module.
  I get the following exception:
      ImportError: %s
***************
*** 39,52 ****
          python_dir = os.path.dirname(python_exe)
          program_files = os.path.dirname(python_dir)
          def tclcheck(dir):
!             for minor in 0,1,2:
!                 ok = 1
!                 for dll in "tcl8%1d.dll", "tk8%1d.dll", "tclpip8%1d.dll":
!                     if not os.path.isfile(os.path.join(dir, dll % minor)):
!                         ok = 0
!                 if ok:
!                     return 1
!             return 0
          for tcldir in [program_files, "\\Program files", "\\",
                         "C:\\Program Files", "D:\\Program Files"]:
              tcldir = os.path.join(tcldir, "Tcl", "bin")
--- 39,48 ----
          python_dir = os.path.dirname(python_exe)
          program_files = os.path.dirname(python_dir)
          def tclcheck(dir):
!             for dll in "tcl80.dll", "tk80.dll", "tclpip80.dll":
!                 if not os.path.isfile(os.path.join(dir, dll)):
!                     return 0
!             return 1
          for tcldir in [program_files, "\\Program files", "\\",
                         "C:\\Program Files", "D:\\Program Files"]:
              tcldir = os.path.join(tcldir, "Tcl", "bin")


For UNIX builds, you can skip much of this and probably only need to make
the requisite mods of _tkinter.c, tkappinit.c, and FixTk.py.

Robin Becker <robin at jessikat.demon.co.uk> wrote in message
news:qtR8IAAhFEo4Ew$E at jessikat.demon.co.uk...
> has anyone got a Tk8.2 compatible version of PIL?
> --
> Robin Becker

Hope this helps,
Jonathan





More information about the Python-list mailing list