[PythonCE] DLL hourglass in ctypes

Christopher Fairbairn christopher at christec.co.nz
Tue Aug 12 23:59:50 CEST 2008


Hi,

On Wed 13/08/08 05:43 , "Adam Walley" adam.walley at gmail.com sent:
> My question is about the hourglass which appears on the screen while
> my script is running (in WM5 it's actually not an hourglass, but a
> kind of circular dial with windows colours).

This is caused by a design decision from the original Windows CE port of Python.
The core executable displays a wait cursor and then waits for the internal shell
script (pcceshell.py) to load. One of the first things the shell script does is
turn off the wait cursor by calling back into the native C code.

If you run a script or do anything else which causes the python shell not to
load, the cursor won't be hidden. Libraries such as ppygui "resolve" this by
explictly hiding the wait cursor as part of their own initialisation process.

They use code along the lines of:

   import _pcceshell_support
  _pcceshell_support.Busy(0);

I haven't liked this, since it means each library needs to be aware of something
PythonCE specific. For cleaness I think the native C part of the Python
interpreter can (and should) take care of this.

Three options I experimented with were

1) Removing the wait cursor entirely if the PythonCE executable was being started
to run a specific script (didn't work too well, depending upon the size of your
script this meant the user was presented with no visual que that anything was
happening for a long period of time).

2) Modifying the script loading mechanism in pythonce.c so the native C code is
aware once the script has been parsed, but hasn't started execution and have it
explictly turn off the wait cursor before handing control over to the python code.

3) Always load the shell (even if PythonCE is started to run a specific script),
then launch the user script by simulating the user entering a call to the
execfile function.

If anyone is actively working on the core interpreter I would be happy to share
more detailed thoughts.

Hope it helps,
Christopher Fairbairn



More information about the PythonCE mailing list