- try {
- OCC_CATCH_SIGNALS
- Standard_Integer res = Tk_Init(interp) ;
- if (res != TCL_OK)
- cout << "tkLoop: error in Tk initialization. Tcl reported: " << interp->result << endl;
-
- } catch (Standard_Failure) {
- cout <<"tkLoop: exception in TK_Init "<<endl;
- }
- Tcl_StaticPackage(interp, "Tk", Tk_Init, (Tcl_PackageInitProc *) NULL);
-
- mainWindow =
- Tk_MainWindow(interp) ;
- if (mainWindow == NULL) {
- fprintf(stderr, "%s\n", interp->result);
- cout << "tkLoop: Tk_MainWindow() returned NULL. Exiting..." << endl;
- Tcl_Exit(0);
- }
- Tk_Name(mainWindow) =
- Tk_GetUid(Tk_SetAppName(mainWindow,
- "Draw")) ;
-
- if (Draw_VirtualWindows) {
- // main window will never shown
- Tcl_Eval(theCommands.Interp(), "wm withdraw .");
+ // initialize the Tk library if not in 'virtual windows' mode
+ // (virtual windows are created by OCCT with native APIs,
+ // thus Tk will be useless)
+ if (!Draw_VirtualWindows)
+ {
+ try
+ {
+ OCC_CATCH_SIGNALS
+ Standard_Integer res = Tk_Init (interp);
+ if (res != TCL_OK)
+ {
+ cout << "tkLoop: error in Tk initialization. Tcl reported: " << interp->result << endl;
+ }
+ }
+ catch (Standard_Failure)
+ {
+ cout << "tkLoop: exception in TK_Init\n";
+ }
+ Tcl_StaticPackage (interp, "Tk", Tk_Init, (Tcl_PackageInitProc* ) NULL);
+ mainWindow = Tk_MainWindow (interp);
+ if (mainWindow == NULL)
+ {
+ fprintf (stderr, "%s\n", interp->result);
+ cout << "tkLoop: Tk_MainWindow() returned NULL. Exiting...\n";
+ Tcl_Exit (0);
+ }
+ Tk_Name(mainWindow) = Tk_GetUid (Tk_SetAppName (mainWindow, "Draw"));