[IPython-User] [PySide] PyOS_InputHook support in pyside?
Renato Araujo Oliveira Filho
Thu Aug 25 12:03:26 CDT 2011
Hi Cris, great work.
I have been thinking about implement this functionality in PySide, but
my first idea is implement a class derived by QApplication, that
implement the exec_ function in a way where the processEvents is
called by a timer. I never try that before then I did not know if this
On Sat, Aug 20, 2011 at 7:34 PM, Christopher Lee-Messer
> Thanks for all the great work on pyside.
> I've been using PySide in the latest enthought python distribution
> (7.1-2) and on
> my ubuntu laptop using the pyside PPA. I do interactive signal
> analysis and would
> like to incorporate pyside into my programs along with ipython. One feature that
> is quite nice about Tkinter and PyQt is that you can continue to run
> and interact
> with python at the command line while running gui widgets.
> When I try this from python's interpreter or from ipython (version 0.11) with
> pyside, the interpreter blocks while the gui elements are active. I looked into
> why by digging through the ipython code and it looks like it tries to invoke
> something called QtCore.pyqtRestoreInputHook(). This doesn't exist in PySide.
> Looking at the _tkinter.c code, it seems this is done via python's C-API using a
> pointer, PyOS_InputHook. I'd never heard of it before, but the way it appears to
> work, is that while python is waiting for text input, it calls this function to
> do idle processing--allowing for gui event processing during these idle times.
> I was hoping that PySide could include support for this. Perhaps it already does
> but I didn't find it?
> In an effort to get things working in my use case and to be helpful to the
> greater python/pyside cause, I have been experimenting with a prototype.
> Just as warning, it is written starting from a state of profound ignorance:
> I have only vague memories of Qt's and python's threading model and
> this is first
> use of Qt's QCoreApplication::processEvents() . I've made a couple of
> guesses about what QCoreApplication
> and processEvents did.
> Surprisingly, after some experimentation, my prototype appears to work, at least
> in a few individual cases I've tried.
> My development platform is python 2.7 on linux x86_64 (ubuntu 10.10)
> using pyside
> 1.05. I linked it to Qt 4.7.3 and libpython2.7 but doesn't depend on the pyside
> code, just Qt. If I knew how to use ctypes to access C++ libraries,
> it probably wouldn't even require the compilation step.
> ipython uses git, so I've put the repo at
> Comments are welcome. However, I don't really have time right now to
> directly contribute to PySide because of my other duties. I did a
> quick look through on shiboken and company and it seemed I was
> unlikely to make it through before I ran out of weekend tim.
> I'm hoping that a PySide wizard might be able to use my code as
> motivation to easily add the equivalent functions directly to PySide
> PySide mailing list
Renato Araujo Oliveira Filho
Instituto Nokia de Tecnologia - INdT
More information about the IPython-User