[Python-checkins] python/dist/src/Modules _tkinter.c,1.165,1.166
loewis at users.sourceforge.net
loewis at users.sourceforge.net
Tue Aug 3 20:45:34 CEST 2004
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15817/Modules
Modified Files:
_tkinter.c
Log Message:
Patch #986929: Add support for wish -sync and -use options.
Index: _tkinter.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v
retrieving revision 1.165
retrieving revision 1.166
diff -C2 -d -r1.165 -r1.166
*** _tkinter.c 19 Feb 2004 02:44:22 -0000 1.165
--- _tkinter.c 3 Aug 2004 18:45:31 -0000 1.166
***************
*** 577,581 ****
static TkappObject *
Tkapp_New(char *screenName, char *baseName, char *className,
! int interactive, int wantobjects, int wantTk)
{
TkappObject *v;
--- 577,581 ----
static TkappObject *
Tkapp_New(char *screenName, char *baseName, char *className,
! int interactive, int wantobjects, int wantTk, int sync, char *use)
{
TkappObject *v;
***************
*** 645,648 ****
--- 645,677 ----
}
+ /* some initial arguments need to be in argv */
+ if (sync || use) {
+ int len = 0;
+ if (sync)
+ len += sizeof "-sync";
+ if (use)
+ len += strlen(use) + sizeof "-use ";
+
+ char *args = (char*)ckalloc(len);
+ if (!args) {
+ PyErr_NoMemory();
+ Py_DECREF(v);
+ return NULL;
+ }
+
+ args[0] = '\0';
+ if (sync)
+ strcat(args, "-sync");
+ if (use) {
+ if (sync)
+ strcat(args, " ");
+ strcat(args, "-use ");
+ strcat(args, use);
+ }
+
+ Tcl_SetVar(v->interp, "argv", args, TCL_GLOBAL_ONLY);
+ ckfree(args);
+ }
+
if (Tcl_AppInit(v->interp) != TCL_OK)
return (TkappObject *)Tkinter_Error((PyObject *)v);
***************
*** 2836,2839 ****
--- 2865,2870 ----
int wantobjects = 0;
int wantTk = 1; /* If false, then Tk_Init() doesn't get called */
+ int sync = 0; /* pass -sync to wish */
+ char *use = NULL; /* pass -use to wish */
baseName = strrchr(Py_GetProgramName(), '/');
***************
*** 2844,2854 ****
className = "Tk";
! if (!PyArg_ParseTuple(args, "|zssiii:create",
&screenName, &baseName, &className,
! &interactive, &wantobjects, &wantTk))
return NULL;
return (PyObject *) Tkapp_New(screenName, baseName, className,
! interactive, wantobjects, wantTk);
}
--- 2875,2887 ----
className = "Tk";
! if (!PyArg_ParseTuple(args, "|zssiiiiz:create",
&screenName, &baseName, &className,
! &interactive, &wantobjects, &wantTk,
! &sync, &use))
return NULL;
return (PyObject *) Tkapp_New(screenName, baseName, className,
! interactive, wantobjects, wantTk,
! sync, use);
}
More information about the Python-checkins
mailing list