]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
added interface to Tk_DoOneEvent (R Lindsay Todd)
authorGuido van Rossum <guido@python.org>
Tue, 10 Jan 1995 17:42:51 +0000 (17:42 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 10 Jan 1995 17:42:51 +0000 (17:42 +0000)
Modules/_tkinter.c

index 77b1809f46c10e90adfa1f62c893ae143a66614b..96a1c938d3e780352078271ed5c66a7995004992 100644 (file)
@@ -1030,6 +1030,26 @@ Tkapp_MainLoop (self, args)
   return Py_None;
 }
 
+static PyObject *
+Tkapp_DoOneEvent (self, args)
+    PyObject *self;
+    PyObject *args;
+{
+    int        flags;
+    int rv;
+
+    if (PyArg_Parse (args, ""))
+       flags = TK_ALL_EVENTS;
+    else
+      {
+        PyErr_Clear();
+       if (!PyArg_Parse (args, "i", &flags))
+         return NULL;
+      }
+    rv = Tk_DoOneEvent(flags);
+    return Py_BuildValue ("i", rv);
+}
+
 static PyObject *
 Tkapp_Quit (self, args)
      PyObject *self;
@@ -1076,6 +1096,7 @@ static PyMethodDef Tkapp_methods[] =
   {"deletefilehandler", Tkapp_DeleteFileHandler},
   {"createtimerhandler", Tkapp_CreateTimerHandler},
   {"mainloop", Tkapp_MainLoop},
+  {"dooneevent", Tkapp_DoOneEvent},
   {"quit", Tkapp_Quit},
   {NULL, NULL}
 };
@@ -1165,6 +1186,7 @@ static PyMethodDef moduleMethods[] =
   {"deletefilehandler", Tkapp_DeleteFileHandler},
   {"createtimerhandler", Tkapp_CreateTimerHandler},
   {"mainloop", Tkapp_MainLoop},
+  {"dooneevent", Tkapp_DoOneEvent},
   {"quit", Tkapp_Quit},
   {NULL, NULL}
 };
@@ -1216,6 +1238,18 @@ PyInit_tkinter ()
   PyDict_SetItemString (d, "WRITABLE", v);
   v = Py_BuildValue ("i", TK_EXCEPTION);
   PyDict_SetItemString (d, "EXCEPTION", v);
+  v = Py_BuildValue ("i", TK_X_EVENTS);
+  PyDict_SetItemString (d, "X_EVENTS", v);
+  v = Py_BuildValue ("i", TK_FILE_EVENTS);
+  PyDict_SetItemString (d, "FILE_EVENTS", v);
+  v = Py_BuildValue ("i", TK_TIMER_EVENTS);
+  PyDict_SetItemString (d, "TIMER_EVENTS", v);
+  v = Py_BuildValue ("i", TK_IDLE_EVENTS);
+  PyDict_SetItemString (d, "IDLE_EVENTS", v);
+  v = Py_BuildValue ("i", TK_ALL_EVENTS);
+  PyDict_SetItemString (d, "ALL_EVENTS", v);
+  v = Py_BuildValue ("i", TK_DONT_WAIT);
+  PyDict_SetItemString (d, "DONT_WAIT", v);
 
 #ifdef WITH_READLINE
   rl_event_hook = EventHook;