Fredrik Lundh is sharing code with you
Bitbucket is a code hosting site. Unlimited public and private repositories. Free for small teams.
Don't show this againpil-2009-raclette / Tk / install.txt
- commit
- 454b4d2672f3
- parent
- 64f9636f4d92
- branch
- default
- tags
- pil-117-20090317, pil-117a1-20090317
Don't try to open files twice if plugins are already loaded.
1 |
770a9717f387
|
==================================================================== |
2 |
770a9717f387
|
Using PIL With Tkinter |
3 |
770a9717f387
|
==================================================================== |
4 |
770a9717f387
|
|
5 |
770a9717f387
|
Starting with 1.0 final (release candidate 2 and later, to be |
6 |
770a9717f387
|
precise), PIL can attach itself to Tkinter in flight. As a result, |
7 |
770a9717f387
|
you no longer need to rebuild the Tkinter extension to be able to |
8 |
770a9717f387
|
use PIL. |
9 |
770a9717f387
|
|
10 |
770a9717f387
|
However, if you cannot get the this to work on your platform, you |
11 |
770a9717f387
|
can do it in the old way: |
12 |
770a9717f387
|
|
13 |
770a9717f387
|
* Adding Tkinter support |
14 |
770a9717f387
|
|
15 |
770a9717f387
|
1. Compile Python's _tkinter.c with the WITH_APPINIT and WITH_PIL |
16 |
770a9717f387
|
flags set, and link it with tkImaging.c and tkappinit.c. To |
17 |
770a9717f387
|
do this, copy the former to the Modules directory, and edit |
18 |
770a9717f387
|
the _tkinter line in Setup (or Setup.in) according to the |
19 |
770a9717f387
|
instructions in that file. |
20 |
770a9717f387
|
|
21 |
770a9717f387
|
NOTE: if you have an old Python version, the tkappinit.c |
22 |
770a9717f387
|
file is not included by default. If this is the case, you |
23 |
770a9717f387
|
will have to add the following lines to tkappinit.c, after |
24 |
770a9717f387
|
the MOREBUTTONS stuff: |
25 |
770a9717f387
|
|
26 |
770a9717f387
|
{ |
27 |
770a9717f387
|
extern void TkImaging_Init(Tcl_Interp* interp); |
28 |
770a9717f387
|
TkImaging_Init(interp); |
29 |
770a9717f387
|
} |
30 |
770a9717f387
|
|
31 |
770a9717f387
|
This registers a Tcl command called "PyImagingPhoto", which is |
32 |
770a9717f387
|
use to communicate between PIL and Tk's PhotoImage handler. |
33 |
770a9717f387
|
|
34 |
770a9717f387
|
You must also change the _tkinter line in Setup (or Setup.in) |
35 |
770a9717f387
|
to something like: |
36 |
770a9717f387
|
|
37 |
770a9717f387
|
_tkinter _tkinter.c tkImaging.c tkappinit.c -DWITH_APPINIT |
38 |
770a9717f387
|
-I/usr/local/include -L/usr/local/lib -ltk8.0 -ltcl8.0 -lX11 |
39 |
770a9717f387
|
|
40 |
770a9717f387
|
|
41 |
770a9717f387
|