static int text_cmd_quit(ClientData cd, Tcl_Interp *interp, int argc,
                            const char *argv[]) {

  VMDApp *app = (VMDApp *)cd;
  // Trigger exit sequence on next display update.  
  // Avoid calling VMDexit more than once.
  if (!app->exitFlag) app->VMDexit("",0,0);

  // return TCL_ERROR so that execution of procs or sourcing of files
  // stops here as well.
  return TCL_ERROR;
}
Exemple #2
0
static PyObject *py_vmdexit(PyObject *self, PyObject *args) {
  char *msg;
  int code = 0;
  int pauseseconds = 0;
  if (!PyArg_ParseTuple(args, "s|ii", &msg, &code, &pauseseconds))
    return NULL;
  VMDApp *app = get_vmdapp();
  app->VMDexit(msg, code, pauseseconds);
  // don't call VMDshutdown, because calling Tcl_Finalize() crashes Tkinter
  // Maybe add a callback to the Python atexit module?
  Py_INCREF(Py_None);
  return Py_None; 
}
 // override the hide() method since we have no way of getting it back
 void hide() {
   if (fl_show_question("Really Quit?", 0))
     app->VMDexit("",0,0);
 }
static void quit_cb(Fl_Widget *w, void *) {
  VMDApp *app = (VMDApp *)(w->user_data());
  if (fl_show_question("Really Quit?", 0))
    app->VMDexit("",0,0);
}