mirror of
https://github.com/python/cpython.git
synced 2025-12-04 08:34:25 +00:00
use getnewargs where it makes sense
This commit is contained in:
parent
53bb7fff11
commit
e42fc2fd37
1 changed files with 17 additions and 40 deletions
|
|
@ -1005,12 +1005,8 @@ Tkapp_MainLoop (self, args)
|
||||||
{
|
{
|
||||||
int threshold = 0;
|
int threshold = 0;
|
||||||
|
|
||||||
if (!PyArg_Parse (args, ""))
|
if (!PyArg_ParseTuple (args, "|i", &threshold))
|
||||||
{
|
return NULL;
|
||||||
PyErr_Clear();
|
|
||||||
if (!PyArg_Parse (args, "i", &threshold))
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
quitMainLoop = 0;
|
quitMainLoop = 0;
|
||||||
while (tk_NumMainWindows > threshold && !quitMainLoop && !errorInCmd)
|
while (tk_NumMainWindows > threshold && !quitMainLoop && !errorInCmd)
|
||||||
|
|
@ -1039,17 +1035,11 @@ Tkapp_DoOneEvent (self, args)
|
||||||
PyObject *self;
|
PyObject *self;
|
||||||
PyObject *args;
|
PyObject *args;
|
||||||
{
|
{
|
||||||
int flags;
|
int flags = TK_ALL_EVENTS;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
if (PyArg_Parse (args, ""))
|
if (!PyArg_ParseTuple (args, "|i", &flags))
|
||||||
flags = TK_ALL_EVENTS;
|
return NULL;
|
||||||
else
|
|
||||||
{
|
|
||||||
PyErr_Clear();
|
|
||||||
if (!PyArg_Parse (args, "i", &flags))
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
rv = Tk_DoOneEvent(flags);
|
rv = Tk_DoOneEvent(flags);
|
||||||
return Py_BuildValue ("i", rv);
|
return Py_BuildValue ("i", rv);
|
||||||
}
|
}
|
||||||
|
|
@ -1099,8 +1089,8 @@ static PyMethodDef Tkapp_methods[] =
|
||||||
{"createfilehandler", Tkapp_CreateFileHandler},
|
{"createfilehandler", Tkapp_CreateFileHandler},
|
||||||
{"deletefilehandler", Tkapp_DeleteFileHandler},
|
{"deletefilehandler", Tkapp_DeleteFileHandler},
|
||||||
{"createtimerhandler", Tkapp_CreateTimerHandler},
|
{"createtimerhandler", Tkapp_CreateTimerHandler},
|
||||||
{"mainloop", Tkapp_MainLoop},
|
{"mainloop", Tkapp_MainLoop, 1},
|
||||||
{"dooneevent", Tkapp_DoOneEvent},
|
{"dooneevent", Tkapp_DoOneEvent, 1},
|
||||||
{"quit", Tkapp_Quit},
|
{"quit", Tkapp_Quit},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
@ -1151,8 +1141,8 @@ Tkinter_Create (self, args)
|
||||||
PyObject *args;
|
PyObject *args;
|
||||||
{
|
{
|
||||||
char *screenName = NULL;
|
char *screenName = NULL;
|
||||||
char *baseName;
|
char *baseName = NULL;
|
||||||
char *className;
|
char *className = NULL;
|
||||||
int interactive = 0;
|
int interactive = 0;
|
||||||
|
|
||||||
baseName = strrchr (getprogramname (), '/');
|
baseName = strrchr (getprogramname (), '/');
|
||||||
|
|
@ -1162,21 +1152,8 @@ Tkinter_Create (self, args)
|
||||||
baseName = getprogramname ();
|
baseName = getprogramname ();
|
||||||
className = "Tk";
|
className = "Tk";
|
||||||
|
|
||||||
if (PyArg_Parse (args, ""))
|
if (!PyArg_ParseTuple (args, "|zssi",
|
||||||
/* VOID */ ;
|
&screenName, &baseName, &className, &interactive))
|
||||||
else if (PyArg_Parse (args, "z",
|
|
||||||
&screenName))
|
|
||||||
/* VOID */ ;
|
|
||||||
else if (PyArg_Parse (args, "(zs)",
|
|
||||||
&screenName, &baseName))
|
|
||||||
/* VOID */ ;
|
|
||||||
else if (PyArg_Parse (args, "(zss)",
|
|
||||||
&screenName, &baseName, &className))
|
|
||||||
/* VOID */ ;
|
|
||||||
else if (PyArg_Parse (args, "(zssi)",
|
|
||||||
&screenName, &baseName, &className, &interactive))
|
|
||||||
/* VOID */ ;
|
|
||||||
else
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return (PyObject *) Tkapp_New (screenName, baseName, className,
|
return (PyObject *) Tkapp_New (screenName, baseName, className,
|
||||||
|
|
@ -1185,12 +1162,12 @@ Tkinter_Create (self, args)
|
||||||
|
|
||||||
static PyMethodDef moduleMethods[] =
|
static PyMethodDef moduleMethods[] =
|
||||||
{
|
{
|
||||||
{"create", Tkinter_Create},
|
{"create", Tkinter_Create, 1},
|
||||||
{"createfilehandler", Tkapp_CreateFileHandler},
|
{"createfilehandler", Tkapp_CreateFileHandler, 0},
|
||||||
{"deletefilehandler", Tkapp_DeleteFileHandler},
|
{"deletefilehandler", Tkapp_DeleteFileHandler, 0},
|
||||||
{"createtimerhandler", Tkapp_CreateTimerHandler},
|
{"createtimerhandler", Tkapp_CreateTimerHandler, 0},
|
||||||
{"mainloop", Tkapp_MainLoop},
|
{"mainloop", Tkapp_MainLoop, 1},
|
||||||
{"dooneevent", Tkapp_DoOneEvent},
|
{"dooneevent", Tkapp_DoOneEvent, 1},
|
||||||
{"quit", Tkapp_Quit},
|
{"quit", Tkapp_Quit},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue