【发布时间】:2012-04-26 19:29:26
【问题描述】:
我需要一种简单的方法来呈现通过请求 (python-requests.org) 检索到的 HTML 页面。我在 Windows 上使用 Python 3.2。
我正在使用 tkinter,我发现了一个名为 TkHtml 的 Tk 小部件。它在http://tkhtml.tcl.tk/ 进行了描述,并且可以从http://www.hwaci.com/sw/tkhtml/ 下载一个DLL。我在 http://tix.sourceforge.net/Tixapps/src/Python/TkHtml.py 找到了一个 python 包装器。
我不知道如何让 TkHtml 在 python 中工作。是否有一些处理 3rd 方 Tk 小部件的标准方法?
我将 tkhtml.dll 放在 Python32\DLLs 中(不知道这是否正确),并将 TkHtml.py 放在 Python32\Lib\site-packages 中。我继续修复 TkHtml.py 中的导入以使用 Python 3(将 tkFileDialog 更改为 tkinter.filedialog,将 Tkinter 更改为 tkinter)。
当我这样做时:
import TkHtml
app=TkHtml.TestApp()
我得到错误:
...
File "C:\Program Files\Python32\lib\site-packages\TkHtml.py", line 45, in __init__
master.tk.call("package", "require", "tkhtml")
_tkinter.TclError: can't find package tkhtml
有什么想法吗?
【问题讨论】:
标签: python tkinter tk html-rendering