Mercurial > cpython-lru_cache-weakref
annotate Modules/tkappinit.c @ 8831:00a6bb65ff29 legacy-trunk
Getting rid of this ancient stuff.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 05 Aug 1998 21:10:09 +0000 |
| parents | 960853902ebe |
| children | 90f4830e2122 |
| rev | line source |
|---|---|
|
6621
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
1 /* appinit.c -- Tcl and Tk application initialization. |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
2 |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
3 The function Tcl_AppInit() below initializes various Tcl packages. |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
4 It is called for each Tcl interpreter created by _tkinter.create(). |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
5 It needs to be compiled with -DWITH_<package> flags for each package |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
6 that you are statically linking with. You may have to add sections |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
7 for packages not yet listed below. |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
8 |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
9 Note that those packages for which Tcl_StaticPackage() is called with |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
10 a NULL first argument are known as "static loadable" packages to |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
11 Tcl but not actually initialized. To use these, you have to load |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
12 it explicitly, e.g. tkapp.eval("load {} Blt"). |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
13 */ |
| 1691 | 14 |
| 15 #include <tcl.h> | |
| 16 #include <tk.h> | |
| 17 | |
| 18 int | |
|
6621
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
19 Tcl_AppInit(interp) |
| 4955 | 20 Tcl_Interp *interp; |
| 1691 | 21 { |
| 4955 | 22 Tk_Window main; |
| 1691 | 23 |
| 4955 | 24 main = Tk_MainWindow(interp); |
| 1691 | 25 |
| 4955 | 26 if (Tcl_Init (interp) == TCL_ERROR) |
| 27 return TCL_ERROR; | |
| 28 if (Tk_Init (interp) == TCL_ERROR) | |
| 29 return TCL_ERROR; | |
| 1691 | 30 |
| 31 #ifdef WITH_MOREBUTTONS | |
| 4955 | 32 { |
| 33 extern Tcl_CmdProc studButtonCmd; | |
| 34 extern Tcl_CmdProc triButtonCmd; | |
| 1691 | 35 |
| 4955 | 36 Tcl_CreateCommand(interp, "studbutton", studButtonCmd, |
| 37 (ClientData) main, NULL); | |
| 38 Tcl_CreateCommand(interp, "tributton", triButtonCmd, | |
| 39 (ClientData) main, NULL); | |
| 40 } | |
| 1691 | 41 #endif |
|
5518
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
42 |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
43 #ifdef WITH_PIL /* 0.2b5 and later -- not yet released as of May 14 */ |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
44 { |
|
6621
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
45 extern void TkImaging_Init(Tcl_Interp *); |
|
5518
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
46 TkImaging_Init(interp); |
|
6621
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
47 /* XXX TkImaging_Init() doesn't have the right return type */ |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
48 /*Tcl_StaticPackage(interp, "Imaging", TkImaging_Init, NULL);*/ |
|
5518
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
49 } |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
50 #endif |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
51 |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
52 #ifdef WITH_PIL_OLD /* 0.2b4 and earlier */ |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
53 { |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
54 extern void TkImaging_Init(void); |
|
6621
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
55 /* XXX TkImaging_Init() doesn't have the right prototype */ |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
56 /*Tcl_StaticPackage(interp, "Imaging", TkImaging_Init, NULL);*/ |
|
5518
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
57 } |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
58 #endif |
|
576b7d927afb
Add sections for PIL (Fred Lundh).
Guido van Rossum <guido@python.org>
parents:
4955
diff
changeset
|
59 |
|
6603
7a0a48d73076
Add optional support fort Tix and BLT.
Guido van Rossum <guido@python.org>
parents:
5518
diff
changeset
|
60 #ifdef WITH_TIX |
|
6720
960853902ebe
Yes, Virginia, Tix does have a Tix_SafeInit() function.
Guido van Rossum <guido@python.org>
parents:
6621
diff
changeset
|
61 { |
|
960853902ebe
Yes, Virginia, Tix does have a Tix_SafeInit() function.
Guido van Rossum <guido@python.org>
parents:
6621
diff
changeset
|
62 extern int Tix_Init(Tcl_Interp *interp); |
|
960853902ebe
Yes, Virginia, Tix does have a Tix_SafeInit() function.
Guido van Rossum <guido@python.org>
parents:
6621
diff
changeset
|
63 extern int Tix_SafeInit(Tcl_Interp *interp); |
|
960853902ebe
Yes, Virginia, Tix does have a Tix_SafeInit() function.
Guido van Rossum <guido@python.org>
parents:
6621
diff
changeset
|
64 Tcl_StaticPackage(NULL, "Tix", Tix_Init, Tix_SafeInit); |
|
960853902ebe
Yes, Virginia, Tix does have a Tix_SafeInit() function.
Guido van Rossum <guido@python.org>
parents:
6621
diff
changeset
|
65 } |
|
6603
7a0a48d73076
Add optional support fort Tix and BLT.
Guido van Rossum <guido@python.org>
parents:
5518
diff
changeset
|
66 #endif |
|
7a0a48d73076
Add optional support fort Tix and BLT.
Guido van Rossum <guido@python.org>
parents:
5518
diff
changeset
|
67 |
|
7a0a48d73076
Add optional support fort Tix and BLT.
Guido van Rossum <guido@python.org>
parents:
5518
diff
changeset
|
68 #ifdef WITH_BLT |
|
6621
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
69 { |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
70 extern int Blt_Init(Tcl_Interp *); |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
71 extern int Blt_SafeInit(Tcl_Interp *); |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
72 Tcl_StaticPackage(NULL, "Blt", Blt_Init, Blt_SafeInit); |
|
6603
7a0a48d73076
Add optional support fort Tix and BLT.
Guido van Rossum <guido@python.org>
parents:
5518
diff
changeset
|
73 } |
|
6621
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
74 #endif |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
75 |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
76 #ifdef WITH_TOGL |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
77 { |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
78 /* XXX I've heard rumors that this doesn't work */ |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
79 extern int Togl_Init(Tcl_Interp *); |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
80 /* XXX Is there no Togl_SafeInit? */ |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
81 Tcl_StaticPackage(NULL, "Togl", Togl_Init, NULL); |
|
b96aad12a150
New tkappinit supporting several popular packages.
Guido van Rossum <guido@python.org>
parents:
6603
diff
changeset
|
82 } |
|
6603
7a0a48d73076
Add optional support fort Tix and BLT.
Guido van Rossum <guido@python.org>
parents:
5518
diff
changeset
|
83 #endif |
|
7a0a48d73076
Add optional support fort Tix and BLT.
Guido van Rossum <guido@python.org>
parents:
5518
diff
changeset
|
84 |
| 1691 | 85 #ifdef WITH_XXX |
| 86 | |
| 87 #endif | |
| 4955 | 88 return TCL_OK; |
| 1691 | 89 } |
