简体   繁体   中英

Change font-size in html Window in wxPython

I am including a html file into my app. However, if I change the font-size in my html for a paragraph, it is not shown in my app. The font-size is still the same for all paragraphs. Is there anything I am forgetting?

 <html> <head> <style> </style> </head> <body> <h2 font-family="arial, sans-serif">{TITLE}</h2> <p>{AUTHORS}</p> <p>{JOURNAL}</p> <br> <br> <p style="font-size: 16pt">{ABSTRACT}</p> <br> <p>{KEYWORDS}</p> <p>{DOI}</p> </body> </html>

As you can see, what will be filled in for the abstract is supposed to be bigger than the other paragraphs. The size in my app however is the same for each paragraph.

I am setting up my html in the app as follows:

class Main(wx.Frame):
    def __init__(self, *args, **kw):
        super(Main, self).__init__(*args, **kw)
        self.html = wx.html.HtmlWindow(self.panel, -1, size=(800, 800))
        self.html.SetStandardFonts()
        self.html.SetPage(html_from_file)

How do you effectively change the font-size of a text in a wxPython html window?

Drawing from @DanA.S.:

I used

self.html = wx.html2.WebView.New(self.panel, -1, size=(800, 800), style=wx.html.HW_SCROLLBAR_AUTO)

and later

self.html.SetPage(my_html_str, "")

to setup my html component. This allowed me to specify all the formatting in my source html file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM