无法在WebView上运行WebGL内容 [英] Cannot run WebGL content on WebView

查看:403
本文介绍了无法在WebView上运行WebGL内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从wxPython WebView打开包含WebGL内容的网页. WebView使用的引擎webkit具有WebGL支持.
如何在WebView中呈现WebGL内容?

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?

我使用的完整代码:

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()

显示以下屏幕

此外,从WebView中打开 https://whatsmybrowser.org 会将浏览器标识为Safari(使用Ubuntu时) .在此处查看完整说明: https://whatsmybrowser.org/b/X43YSDV .

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.

推荐答案

我在wxpython webview中找不到对webGL的支持.
我的解决方案是使用 cefpython . cefpython将完整的Chrome浏览器嵌入python应用程序中.这是使用cefpython的wxpython的示例: https://github.com/cztomczak/cefpython/blob/master/examples/wxpython.py .

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.

这篇关于无法在WebView上运行WebGL内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆