在下面的代码中,如果需要进行文本编辑,则会成功。如果不需要,我会在控制台中看到“try and close”。但景色并没有关闭。 我试过关闭和关闭文件。你知道吗
if not text == orig:
view.run_command('select_all')
view.run_command('cut')
view.run_command('insert_text', {'string': text})
else:
#no change, close if it wasnt already open
if not open_stat:
print('try and close')
view.run_command('close')
我相信close是一个窗口命令,所以试试
view.window().run_command("close")
。我还运行window#focus_view
以确保它处于焦点位置。我不想对事故抱错误的看法(尽管我认为即使这样也有可能)。你知道吗相关问题 更多 >
编程相关推荐