我正在构建一个 python 应用程序,它应该获取特定的 HTML 代码,呈现它并在 tkinter gui 中向用户显示结果。我怎样才能做到这一点?我更喜欢有一些内置模块,或者一些我可以使用 easy_install 获取的模块。感谢您的任何预付款。
(我正在使用 OSX Yosemite 和 python 2.7)
最佳答案
我已经设法使用 tkhtml 呈现简单的 html 标签
只需pip3安装tkinterhtml
并且,来自包裹 example :
from tkinterhtml import HtmlFrame
import tkinter as tk
root = tk.Tk()
frame = HtmlFrame(root, horizontal_scrollbar="auto")
frame.set_content("<html></html>")
frame.set_content(urllib.request.urlopen("http://thonny.cs.ut.ee").read().decode())
希望对您有所帮助:)
关于html - python : How Can I Render HTML Code And Show The Result To The User?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29908340/