NAME
Tk_EventInit - Use the Tk event loop without the rest of Tk
SYNOPSIS
#include <tk.h>
int Tk_EventInit(interp)
ARGUMENTS
DESCRIPTION
This procedure may be invoked to use the Tk event management functions without the rest of Tk (e.g., in applications that do not have access to a display). Tk_EventInit creates the after and fileevent commands in interp. It also creates versions of the tkwait and update commands with reduced functionality: the tkwait command supports only the variable option, not visibility or $widget, and update does not check for X events. Tk_EventInit always returns TCL_OK to signal that it completed successfully.
The event-management procedures in Tk are divided into two groups, those that can be used stand-alone and those that require the full Tk library to be present. The following procedures may be used stand-alone: Tk_CreateFileHandler, Tk_CreateFileHandler2, Tk_DeleteFileHandler, Tk_CreateTimerHandler, Tk_DeleteTimerHandler, Tk_DoWhenIdle, Tk_CancelIdleCall, Tk_DoOneEvent, Tk_Sleep, and Tk_BackgroundError. Note that Tk_MainLoop cannot be used without the full Tk library, since it checks to see if windows are still open. If an application uses the event procedures stand-alone, it must include its own main loop that invokes Tk_DoOneEvent repeatedly.
Tk_EventInit is typically called from an application's Tcl_AppInit procedure; it should not be invoked in applications that use the full Tk library (e.g., those that have already invoked Tk_CreateMainWindow). However, it is OK for an application to start up using Tk_EventInit, compute without X for a while, and later invoke Tk_CreateMainWindow. When Tk_CreateMainWindow is invoked, the full suite of windowing Tcl commands will become available, and the full-blown versions of tkwait and update will replace the abridged versions created with Tk_EventInit.
KEYWORDS
event management, Tcl_AppInit