I'm trying to load an Html file with wx.html.HtmlWindow. The Html file is linked to an external style sheet (CSS) file. The problem is the Html window only shows the plain Html file without styling (colors, fonts, etc.) How can I solve this issue?
HTML code:
<html>
<head>
<title>Embedded Style Sample</title>
<link href="E:\pythonGUI\styles.css" rel="stylesheet" type="text/css"/></head>
<body>
<h1>Embedded Style Sample testing</h1>
<h2>Next Line</h2>
</body>
</html>
CSS code:
h1{
color: #0000FF;
}
h2{
color: #00CCFF;
}
Python code:
import wx
import wx.html
import wx.html2
class MyHtmlFrame(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(
self,
parent,
-1,
title,
size = (600,400)
)
html = wx.html.HtmlWindow(self)
html.LoadPage("E:\\pythonGUI\\newtest.html")
app = wx.App()
frm = MyHtmlFrame(None, "Simple HTML File Viewer")
frm.Show()
app.MainLoop()
the Html file show on HTML window: