Implementation of patch 869468

Allow the user to create Tkinter.Tcl objects which are
just like Tkinter.Tk objects except that they do not
initialize Tk. This is useful in circumstances where the
script is being run on machines that do not have an X
server running -- in those cases, Tk initialization fails,
even if no window is ever created.

Includes documentation change and tests.

Tested on Linux, Solaris and Windows.

Reviewed by Martin von Loewis.
This commit is contained in:
David Ascher 2004-02-18 05:59:53 +00:00
parent f06116dcab
commit e2b4b32025
5 changed files with 264 additions and 16 deletions

View file

@ -19,6 +19,7 @@ int
Tcl_AppInit(Tcl_Interp *interp)
{
Tk_Window main_window;
const char * _tkinter_skip_tk_init;
#ifdef TK_AQUA
#ifndef MAX_PATH_LEN
@ -68,7 +69,15 @@ Tcl_AppInit(Tcl_Interp *interp)
TclSetLibraryPath(pathPtr);
#endif
if (Tk_Init (interp) == TCL_ERROR)
#ifdef WITH_XXX
// Initialize modules that don't require Tk
#endif
_tkinter_skip_tk_init = Tcl_GetVar(interp, "_tkinter_skip_tk_init", TCL_GLOBAL_ONLY);
if (_tkinter_skip_tk_init != NULL && strcmp(_tkinter_skip_tk_init, "1") == 0) {
return TCL_OK;
}
if (Tk_Init(interp) == TCL_ERROR)
return TCL_ERROR;
main_window = Tk_MainWindow(interp);