使用Python tkinter扩展Vim GUI

时间:2013-01-17 19:16:27

标签: python vim plugins tkinter extend

我知道有几种方法可以使用gtk.Socket和DBUS在GTK中集成gVIM:

但是我想知道是否可以说有一个python插件使用tkinter为gVIM GUI添加额外的GUI组件?

问题是如何解释两个主循环:

Python: Is there a way I can run mainloop() in the background

我的第一次尝试是(tkinter.vim):

python << endpython

from Tkinter import *

root = Tk()

w = Label(root, text="Hello, world!")
w.pack()

root.mainloop()

endpython

甚至这个(tkinter-thread.vim):

python << endpython

import Tkinter
import threading
class MyTkApp(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)
        self.start()
    def callback(self):
       self.root.quit()
    def run(self):
        self.root=Tkinter.Tk()
        self.root.protocol("WM_DELETE_WINDOW", self.callback)
        self.s = Tkinter.StringVar()
        self.s.set('Foo')
        l = Tkinter.Label(self.root,textvariable=self.s)
        l.pack()
        self.root.mainloop()
app = MyTkApp()
print 'now can continue running code while mainloop runs'

endpython

一旦你尝试输入内容,他们都会挂起gVIM GUI。

有没有其他方法可以将gVIM GUI扩展到其他GUI组件(windows / toolbar,...)?

0 个答案:

没有答案