小编ePh*_*ipe的帖子

如何在Gtk3中获取DrawingArea窗口句柄?

我在CEF Python 3上获得了此代码(link)

    ...

    self.container = gtk.DrawingArea()
    self.container.set_property('can-focus', True)
    self.container.connect('size-allocate', self.OnSize)
    self.container.show()

    ...

    windowID = self.container.get_window().handle
    windowInfo = cefpython.WindowInfo()
    windowInfo.SetAsChild(windowID)
    self.browser = cefpython.CreateBrowserSync(windowInfo,
            browserSettings={},
            navigateUrl=GetApplicationPath('example.html'))

    ...
Run Code Online (Sandbox Code Playgroud)

这段代码[ self.container.get_window()。handle ]不适用于PyGI和GTK3。

我尝试将代码从GTK2移植到GTK3,该怎么办?

编辑:


一些搜索后,我发现了一个尖,使get_window工作:我叫:self.container.realize()之前self.container.get_window() 。但是我还没有Window Handle。

我需要将CEF3窗口放在DrawingArea或任何元素内。如何使用PyGI做到这一点?

编辑:


我的环境是:

Windows 7的

Python 2.7和Python 3.2

python pygobject gtk3 chromium-embedded

5
推荐指数
2
解决办法
1553
查看次数

标签 统计

chromium-embedded ×1

gtk3 ×1

pygobject ×1

python ×1