Commit 079c11c0 authored by Bill Hoffman's avatar Bill Hoffman

BUG: make sure tk has been initialized before calling tk functions

parent 0e9670a6
......@@ -424,15 +424,16 @@ extern "C"
extern "C" {VTK_TK_EXPORT int Vtktkimageviewerwidget_Init(Tcl_Interp *interp);}
int Vtktkimageviewerwidget_Init(Tcl_Interp *interp)
{
if (Tcl_PkgProvide(interp, (char *) "Vtktkimageviewerwidget", (char *) "1.2") != TCL_OK)
if(Tcl_PkgPresent(interp, "Tk", TK_VERSION, 0))
{
return TCL_ERROR;
Tcl_CreateCommand(interp, (char *) "vtkTkImageViewerWidget",
vtkTkImageViewerWidget_Cmd,
Tk_MainWindow(interp), NULL);
if (Tcl_PkgProvide(interp, (char *) "Vtktkimageviewerwidget", (char *) "1.2") != TCL_OK)
{
return TCL_ERROR;
}
}
Tcl_CreateCommand(interp, (char *) "vtkTkImageViewerWidget",
vtkTkImageViewerWidget_Cmd,
Tk_MainWindow(interp), NULL);
return TCL_OK;
}
......
......@@ -690,17 +690,19 @@ extern "C" {int VTK_TK_EXPORT Vtktkrenderwidget_Init(Tcl_Interp *interp);}
int VTK_TK_EXPORT Vtktkrenderwidget_Init(Tcl_Interp *interp)
{
if (Tcl_PkgProvide(interp,(char *)"Vtktkrenderwidget",(char *)"1.2") != TCL_OK)
if(Tcl_PkgPresent(interp, "Tk", TK_VERSION, 0))
{
return TCL_ERROR;
Tcl_CreateCommand(interp, (char *) "vtkTkRenderWidget", vtkTkRenderWidget_Cmd,
Tk_MainWindow(interp), NULL);
Tcl_CreateCommand(interp, (char *) "vtkImageDataToTkPhoto", vtkImageDataToTkPhoto_Cmd,
NULL, NULL );
if (Tcl_PkgProvide(interp,(char *)"Vtktkrenderwidget",(char *)"1.2") != TCL_OK)
{
return TCL_ERROR;
}
}
Tcl_CreateCommand(interp, (char *) "vtkTkRenderWidget", vtkTkRenderWidget_Cmd,
Tk_MainWindow(interp), NULL);
Tcl_CreateCommand(interp, (char *) "vtkImageDataToTkPhoto", vtkImageDataToTkPhoto_Cmd,
NULL, NULL );
return TCL_OK;
}
......
......@@ -64,18 +64,20 @@ extern "C"
int Vtkrenderingpythontkwidgets_Init(Tcl_Interp *interp)
{
if (Tcl_PkgProvide(interp, (char *) "Vtkrenderingpythontkwidgets", (char *) "1.2") != TCL_OK)
if(Tcl_PkgPresent(interp, "Tk", TK_VERSION, 0))
{
return TCL_ERROR;
Tcl_CreateCommand(interp, (char *) "vtkTkRenderWidget", vtkTkRenderWidget_Cmd,
Tk_MainWindow(interp), NULL);
Tcl_CreateCommand(interp, (char *) "vtkTkImageViewerWidget",
vtkTkImageViewerWidget_Cmd, Tk_MainWindow(interp), NULL);
Tcl_CreateCommand(interp, (char *) "vtkImageDataToTkPhoto", vtkImageDataToTkPhoto_Cmd,
NULL, NULL );
if (Tcl_PkgProvide(interp, (char *) "Vtkrenderingpythontkwidgets", (char *) "1.2") != TCL_OK)
{
return TCL_ERROR;
}
}
Tcl_CreateCommand(interp, (char *) "vtkTkRenderWidget", vtkTkRenderWidget_Cmd,
Tk_MainWindow(interp), NULL);
Tcl_CreateCommand(interp, (char *) "vtkTkImageViewerWidget",
vtkTkImageViewerWidget_Cmd, Tk_MainWindow(interp), NULL);
Tcl_CreateCommand(interp, (char *) "vtkImageDataToTkPhoto", vtkImageDataToTkPhoto_Cmd,
NULL, NULL );
return TCL_OK;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment