我正在为崇高的文本3编写一个插件,所以我需要做两件事中的一件:
1)每300毫秒运行一次函数;2)每当光标改变位置时运行一个函数
尽管我一直在查看文档并检查Default包中的示例,但我在实现目标方面仍有困难。帮助我的是,每次满足上述两个条件之一时,都会将"hello,world“打印到缓冲区中。谢谢。
发布于 2014-02-28 08:52:20
作为我对this question的一个回答,它有类似的内容,您还可以为每300 As运行一次添加set_timeout:
annoying_helloworld.py
class someclass():
def run(x):
print("Hello world!" + str(x))
def run_with_timeout(x):
someclass.run(x)
sublime.set_timeout(lambda: someclass.run_with_timeout(123), 300)
class utfcodeCommand(sublime_plugin.EventListener):
def on_selection_modified(self, view):
someclass.run(666)
sublime.set_timeout(lambda: someclass.run_with_timeout(123), 300)https://stackoverflow.com/questions/22077379
复制相似问题