Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
28e9ce9d
Commit
28e9ce9d
authored
May 09, 2003
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #734118: Add {get|set}busywaitinterval.
parent
16e426bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
2 deletions
+46
-2
Misc/NEWS
Misc/NEWS
+2
-0
Modules/_tkinter.c
Modules/_tkinter.c
+44
-2
No files found.
Misc/NEWS
View file @
28e9ce9d
...
...
@@ -23,6 +23,8 @@ Core and builtins
Extension
modules
-----------------
-
_tkinter
.{
get
|
set
}
busywaitinterval
was
added
.
-
itertools
.
islice
()
now
accepts
stop
=
None
as
documented
.
Fixes
SF
bug
#
730685.
...
...
Modules/_tkinter.c
View file @
28e9ce9d
...
...
@@ -318,6 +318,8 @@ Tkinter_Error(PyObject *v)
/**** Utils ****/
static
int
Tkinter_busywaitinterval
=
20
;
#ifdef WITH_THREAD
#ifndef MS_WINDOWS
...
...
@@ -2519,7 +2521,7 @@ Tkapp_MainLoop(PyObject *_self, PyObject *args)
tcl_tstate
=
NULL
;
if
(
tcl_lock
)
PyThread_release_lock
(
tcl_lock
);
if
(
result
==
0
)
Sleep
(
20
);
Sleep
(
Tkinter_busywaitinterval
);
Py_END_ALLOW_THREADS
}
#else
...
...
@@ -2831,6 +2833,42 @@ Tkinter_Create(PyObject *self, PyObject *args)
interactive
,
wantobjects
);
}
static
PyObject
*
Tkinter_setbusywaitinterval
(
PyObject
*
self
,
PyObject
*
args
)
{
int
new_val
;
if
(
!
PyArg_ParseTuple
(
args
,
"i:setbusywaitinterval"
,
&
new_val
))
return
NULL
;
if
(
new_val
<
0
)
{
PyErr_SetString
(
PyExc_ValueError
,
"busywaitinterval must be >= 0"
);
return
NULL
;
}
Tkinter_busywaitinterval
=
new_val
;
Py_INCREF
(
Py_None
);
return
Py_None
;
}
static
char
setbusywaitinterval_doc
[]
=
"setbusywaitinterval(n) -> None
\n
\
\n
\
Set the busy-wait interval in milliseconds between successive
\n
\
calls to Tcl_DoOneEvent in a threaded Python interpreter.
\n
\
It should be set to a divisor of the maximum time between
\n
\
frames in an animation."
;
static
PyObject
*
Tkinter_getbusywaitinterval
(
PyObject
*
self
,
PyObject
*
args
)
{
return
PyInt_FromLong
(
Tkinter_busywaitinterval
);
}
static
char
getbusywaitinterval_doc
[]
=
"getbusywaitinterval() -> int
\n
\
\n
\
Return the current busy-wait interval between successive
\n
\
calls to Tcl_DoOneEvent in a threaded Python interpreter."
;
static
PyMethodDef
moduleMethods
[]
=
{
{
"_flatten"
,
Tkinter_Flatten
,
METH_VARARGS
},
...
...
@@ -2843,6 +2881,10 @@ static PyMethodDef moduleMethods[] =
{
"mainloop"
,
Tkapp_MainLoop
,
METH_VARARGS
},
{
"dooneevent"
,
Tkapp_DoOneEvent
,
METH_VARARGS
},
{
"quit"
,
Tkapp_Quit
,
METH_VARARGS
},
{
"setbusywaitinterval"
,
Tkinter_setbusywaitinterval
,
METH_VARARGS
,
setbusywaitinterval_doc
},
{
"getbusywaitinterval"
,(
PyCFunction
)
Tkinter_getbusywaitinterval
,
METH_NOARGS
,
getbusywaitinterval_doc
},
{
NULL
,
NULL
}
};
...
...
@@ -2895,7 +2937,7 @@ EventHook(void)
tcl_tstate
=
NULL
;
if
(
tcl_lock
)
PyThread_release_lock
(
tcl_lock
);
if
(
result
==
0
)
Sleep
(
20
);
Sleep
(
Tkinter_busywaitinterval
);
Py_END_ALLOW_THREADS
#else
result
=
Tcl_DoOneEvent
(
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment