Read a html file and display it in tkinter window


I am new on Python and I'm working on a project. When I work on GUI, I meet some difficulties.

I need to read a html file and put it on tkinter window. I have been looking for some solutions and someone recommanded tkinterhtml. I copied his example code, but something was wrong with the result. I do not know how to solve the problem. I would appreciate it if someone can help me.

from urllib.request import urlopen
from tkinter import *
import tkinterhtml as th

a = urlopen("")
r =
d = r.decode()

root = Tk()
html = th.HtmlFrame(root)

And the result is:

Process finished with exit code -1073741819 (0xC0000005)
asked on Stack Overflow Feb 16, 2020 by Wang-Zm

1 Answer


This seems to be a problem with your python installation. Try reinstalling python, as it works fine for me:

enter image description here

Also, assuming you want to render HTML, which hasn't worked in the screenshot, I don't reccomend tkinterhtml - it doesn't work very well. PyQt will work a lot better for what you want if you don't mind using it. Install PyQt5 and PyQtWebEngine with pip:

pip install PyQt5
pip install PyQtWebEngine

and then try this example code for what you want:

import sys
from PyQt5.QtCore import *
from PyQt5.QtWebEngineWidgets import *
from PyQt5.QtWidgets import QApplication

app = QApplication(sys.argv)

web = QWebEngineView()


Which gives you this: enter image description here

answered on Stack Overflow Feb 16, 2020 by CookieJarApps

User contributions licensed under CC BY-SA 3.0