如何将 Help.chm 文件合并到 Python 应用程序中?



我正在使用python2.7.12,我想知道如何将*.chm文件添加到python脚本中,以便在按下F12按钮时使其正确启动? 这是我到目前为止所拥有的:

def hchma():
webbrowser.open_new(r"file://C:WINDOWSULIX TxT EditorResourceshelpCenterhelpCentre11.chm")
def hchm(event):
webbrowser.open_new(r"file://C:WINDOWSULIX TxT EditorResourceshelpCenterhelpCentre11.chm")

但是当我在 Win10 以外的任何 Windows 操作系统上运行此代码时,它将打开一个web_browser而不是文件本身。不过,此代码适用于Windows 10。 这是我的根绑定标签

root.bind('<F12>', hchm)

您可以改用子流程,以便直接打开

subprocess.Popen('hh.exe "C:WINDOWSULIX TxT EditorResourceshelpCenterhelpCentre11.chm"')

最新更新