Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > PyOS_InputHook enhancement proposal

Reply
Thread Tools

PyOS_InputHook enhancement proposal

 
 
umdehoon
Guest
Posts: n/a
 
      11-18-2004

PyOS_InputHook is a pointer to a function that is called periodically (ten
times per second) while Python is idle, for example, when waiting for a
user command. Python C extension modules can set this pointer to a hook
function defined in the extension module. For example, _tkinter.c makes
use of PyOS_InputHook to get messages delivered to its widgets.

A problem arises when two or more extension modules want to set
PyOS_InputHook. For example, the scientific plotting package pygist needs
PyOS_InputHook to get messages delivered to its graphics windows, and may
therefore conflict with the Python GUI IDLE, which uses Tkinter. Chaining
won't work, as it will fail when an extension module wants to remove its
hook function.

My suggestion is therefore to replace PyOS_InputHook by two functions
PyOS_AddInputHook and PyOS_RemoveInputHook, and let Python keep track of
which hooks are installed. This way, an extension module can add a hook
function without having to worry about other extension modules trying
to use the same hook.

Any comments? Would I need to submit a PEP for this proposal?

--Michiel, U Tokyo.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run PyOS_InputHook from python code (i.e. yield to event loops) Ville M. Vainio Python 3 09-13-2008 01:54 PM
Firewall software enhancement suggestion ultimotion@gmail.com Cisco 0 11-29-2005 02:25 PM
RDoc enhancement proposal leon breedt Ruby 4 01-23-2005 12:25 PM
Re: asp.net calendar enhancement Fred. ASP .Net 1 07-15-2003 02:43 AM
Re: asp.net calendar enhancement Marlene ASP .Net 0 06-25-2003 04:23 PM



Advertisments