Results: Re: Python/Vim GUI

Mike Dean klaatu at evertek.net
Wed Oct 30 20:21:33 EST 2002


For the benefit of anyone else interested in this concept...

I did a bit of playing with pygtk in my GTK-enabled GVim today.  It 
appears like this will not work.  I tried the quick demo on the PyGTK 
homepage, minus the mainloop() call, and my window was successfully 
created.  But, as soon as I clicked the "Hello World" button, Vim, 
PyGTK, and the whole works promptly hangs, and won't even respond to 
closing the window (and killing it with xkill doesn't make the process 
go away).  I replaced the print "Hello World" with code to append 
"hello world" to the current buffer, and it still froze.

But this may be a more general problem with Vim's embedding and 
reentrancy - I tried creating a simple network server 
(SimpleHTTPServer) that would modify the Vim buffer, and Vim also hung 
then (but the network response, which was executed _after_ the Vim 
command, succeeded).  The same happened when I put the network server 
in a separate thread.

Maybe this generalizes into a question about Python embedding - what 
does it take to make a Python host application fully reentrant?

-Mike

On Tuesday 29 October 2002 06:24 pm, Brian Sturk 
<bsturk at news1.news.adelphia.net> wrote in comp.lang.python:
> On Tue, 29 Oct 2002 13:44:03 -0600, Mike Dean <klaatu at evertek.net>
> wrote:
>> A little question, probably can be generalized into extending GUI
>> programs that support Python scripting, but don't intend for Python
>> to do GUI stuff...
>> 
>> I've been toying around with an idea for a package built around Vim
>> in
>> Python, probably all run from Vim's embedded Python interpreter.  Can
>> I write GUI code in my Python script, i.e., to create some additional
>> helper windows, etc., without modifying Vim to expose its GUI
>> internals?  I'm planning on either using pygtk in a GTK-enabled Vim,
>> or
>> PyKDE/PyQT in KVim.  Does it make much difference, as far as ease of
>> implementation, etc., which one I use?
>> 
>> Or am I possibly better off implementing my GUI code in a separate
>> process communicating with the main Vim process?
> 
> I've written a pretty large vim plugin using python
> called vimsh, and ran into a few issues/limitations.
> Most of these had to do with asynchronous behavior
> and multiple threads accessing the buffer etc.
> 
> Can you run 2 "instances" of these libaries in one process?
> I've tried to use 2 GUI libraries once in python and usually
> I got burned by each one wanting to have lots of control for
> their main event loop.  One that pops into mind was mixing
> pygame(SDL) with wxPython.  Not sure if this would apply
> either.  Your best bet may be to just start tinkering with
> either one.
> 
> HTH,
> ~brian
> 




More information about the Python-list mailing list