问题
I am trying to open a webpage with WebGL content from wxPython WebView. The engine used by WebView, webkit
, has WebGL support.
How can I render the the WebGL content inside WebView?
The complete code used by me:
import wx
import wx.html2
class MyBrowser(wx.Frame):
def __init__(self, *args, **kwds):
wx.Frame.__init__(self, *args, **kwds)
sizer = wx.BoxSizer(wx.VERTICAL)
self.browser = wx.html2.WebView.New(self)
sizer.Add(self.browser, 1, wx.EXPAND, 10)
self.SetSizer(sizer)
self.Maximize()
if __name__ == '__main__':
app = wx.App()
dialog = MyBrowser(None, -1)
dialog.browser.LoadURL("https://get.webgl.org/")
dialog.Show()
app.MainLoop()
gives the below screen
Also, opening https://whatsmybrowser.org from the WebView identifies the browser as Safari (while using Ubuntu). See full description here: https://whatsmybrowser.org/b/X43YSDV.
回答1:
I could not find support for webGL inside wxpython webview.
My solution was to use cefpython. cefpython embeds full chromium browser inside python applications. Here's an example of wxpython using cefpython: https://github.com/cztomczak/cefpython/blob/master/examples/wxpython.py.
来源:https://stackoverflow.com/questions/55723043/cannot-run-webgl-content-on-webview