# import sys
# # import the main window object (mw) from aqt
# from aqt import mw
# # import the "show info" tool from utils.py
# from aqt.utils import showInfo
# # import all of the Qt GUI library
# from aqt.qt import *
# from anki.hooks import addHook
from anki.hooks import wrap
from aqt.editor import Editor
def mySaveNow(self, callback, keepFocus=False):
if self.note: # 有时候竟然会出现None
with open(r'D:\b.txt', 'w', encoding='utf8') as file:
file.write('{} {}'.format(self.note.tags, self.note.fields))
Editor.saveNow = wrap(Editor.saveNow, mySaveNow)
此博客展示了一段Python代码,用于扩展Anki编辑器的保存功能。代码通过导入相关模块,定义了一个新的保存函数mySaveNow,在保存时将笔记的标签和字段信息写入指定文件,并将该函数包装到原有的保存函数中。
1018

被折叠的 条评论
为什么被折叠?



