Updated for 2.1b2 distribution.
[python/dscho.git] / Modules / tkappinit.c
blobc551fcab44d5c5e2b22149c1a3ceb49ad2eca6a1
1 /* appinit.c -- Tcl and Tk application initialization.
3 The function Tcl_AppInit() below initializes various Tcl packages.
4 It is called for each Tcl interpreter created by _tkinter.create().
5 It needs to be compiled with -DWITH_<package> flags for each package
6 that you are statically linking with. You may have to add sections
7 for packages not yet listed below.
9 Note that those packages for which Tcl_StaticPackage() is called with
10 a NULL first argument are known as "static loadable" packages to
11 Tcl but not actually initialized. To use these, you have to load
12 it explicitly, e.g. tkapp.eval("load {} Blt").
15 #include <tcl.h>
16 #include <tk.h>
18 int
19 Tcl_AppInit(Tcl_Interp *interp)
21 Tk_Window main_window;
23 if (Tcl_Init (interp) == TCL_ERROR)
24 return TCL_ERROR;
25 if (Tk_Init (interp) == TCL_ERROR)
26 return TCL_ERROR;
28 main_window = Tk_MainWindow(interp);
30 #ifdef WITH_MOREBUTTONS
32 extern Tcl_CmdProc studButtonCmd;
33 extern Tcl_CmdProc triButtonCmd;
35 Tcl_CreateCommand(interp, "studbutton", studButtonCmd,
36 (ClientData) main_window, NULL);
37 Tcl_CreateCommand(interp, "tributton", triButtonCmd,
38 (ClientData) main_window, NULL);
40 #endif
42 #ifdef WITH_PIL /* 0.2b5 and later -- not yet released as of May 14 */
44 extern void TkImaging_Init(Tcl_Interp *);
45 TkImaging_Init(interp);
46 /* XXX TkImaging_Init() doesn't have the right return type */
47 /*Tcl_StaticPackage(interp, "Imaging", TkImaging_Init, NULL);*/
49 #endif
51 #ifdef WITH_PIL_OLD /* 0.2b4 and earlier */
53 extern void TkImaging_Init(void);
54 /* XXX TkImaging_Init() doesn't have the right prototype */
55 /*Tcl_StaticPackage(interp, "Imaging", TkImaging_Init, NULL);*/
57 #endif
59 #ifdef WITH_TIX
61 extern int Tix_Init(Tcl_Interp *interp);
62 extern int Tix_SafeInit(Tcl_Interp *interp);
63 Tcl_StaticPackage(NULL, "Tix", Tix_Init, Tix_SafeInit);
65 #endif
67 #ifdef WITH_BLT
69 extern int Blt_Init(Tcl_Interp *);
70 extern int Blt_SafeInit(Tcl_Interp *);
71 Tcl_StaticPackage(NULL, "Blt", Blt_Init, Blt_SafeInit);
73 #endif
75 #ifdef WITH_TOGL
77 /* XXX I've heard rumors that this doesn't work */
78 extern int Togl_Init(Tcl_Interp *);
79 /* XXX Is there no Togl_SafeInit? */
80 Tcl_StaticPackage(NULL, "Togl", Togl_Init, NULL);
82 #endif
84 #ifdef WITH_XXX
86 #endif
87 return TCL_OK;