[Twisted-Python] Excel, Twisted, and wxPython

Andrew Dalke dalke at dalkescientific.com
Sun Jun 1 03:23:51 EDT 2003


Hi,

   I'm working on an add-in for Excel, under MS Windows.  This takes 
information
from the current selection and uses XML-RPC to call a remote server.

   The call may take a while, so I want to have a "Cancel" button.  I
decided to use wxPython for the GUI, with a modal dialog.  Basically,
a wxGauge (for the progress bar) and a "Cancel" button.

   The RPC call itself may take several minutes, so I need to use either
threads or Twisted, and obviously I decided on the latter.  (This is an
in-process add-in; I'm worried about using threads inside the Excel
process itself.)

   I can't figure out how to make this all work together.  There's some
support code in Twisted for wxPython, but it appears to only support
the main event loop, while I'm running a modal window, and never call
my wxApp's MainLoop.

   I tried replacing my wxDialog with a wxFrame, which kinda works, 
except
that the background is very strange.  It looks like it hasn't been
fully initialized.

   I've attached my code, in the hopes that someone here can help me
figure out what to do.

   BTW, Twisted's wxPython support subsumes wx's main loop code.  Is
there any reason there can't be an implementation which hooks into
wx's idle loop, so that users can decide who's in charge?  I think that
would actually fix my problem, since Modals (I think) process the
idle loop ...  Nope, I'm not clever enough to figure that out - my
attempt is attached as "Progress2.py"

					Andrew
					dalke at dalkescientific.com

  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Progress.py
Type: application/octet-stream
Size: 3780 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20030601/3e133d50/attachment.obj 
-------------- next part --------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Progress2.py
Type: application/octet-stream
Size: 3784 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20030601/3e133d50/attachment-0001.obj 


More information about the Twisted-Python mailing list