Default Background Color of Webview

Hey all! I’m wondering if its possible set the default background color of the html2.Webview widget. I want to launch a page with a black background and avoid having the white flash from the browser prior to the page loading.

Alternatively, I figure I could try rendering the browser off screen and then showing it after the page is loaded. Any idea how I might do that?

I hacked the standalone version of the example from wxPython Demo: HTML2_WebView_2.py (5.9 KB)

In TestPanel.__init__ I added the following calls:

    self.SetBackgroundColour(wx.BLACK)

and

    self.wv.Hide()

In TestPanel.OnWebViewLoaded I added the following calls:

        print(self.current)
        if self.current != "about:blank":
            self.wv.Show()
            self.Layout()

It sort of works with the wxPython.org website. It may not work with other sites.

Tested using Python 3.10.12 + wxPython 4.2.1 gtk3 (phoenix) wxWidgets 3.2.2.1 on Linux Mint 21.2