我在Windows机器上同时安装了32位和64位Python。当我以32位元运行以下程序时,它可以正常工作,但以64位元运行时,当您单击按钮打开HTML页面时,它以Process finished with exit code -1073741819 (0xC0000005)
崩溃。注释掉标记为# this line
的行使其有效,尽管显然它不显示HTML。我该如何解决?
import tkinter
from tkinter import ttk
import tkinterhtml
class Gui:
root = None
def open_html_page(self):
local_root = tkinter.Toplevel(self.root)
local_root.transient(self.root)
local_root.grab_set()
big_frame = ttk.Frame(local_root)
big_frame.pack(fill='both', expand=True)
html = "<b>This is an <i>HTML</i> page</b>"
html_frame = tkinterhtml.HtmlFrame(local_root)
html_frame.pack()
print(html)
html_frame.set_content(html) # this line
local_root.mainloop()
def launch_gui(self):
self.root = tkinter.Tk()
big_frame = ttk.Frame(self.root)
big_frame.pack(fill='both', expand=True)
open_html_button = ttk.Button(big_frame, text="Open HTML page", command=self.open_html_page)
open_html_button.pack()
self.root.mainloop()
def main():
Gui().launch_gui()
if __name__ == '__main__':
main()