0

环境 - windows7 上的 python2.7、gstreamer 1.0

我试图在我的环境中运行来自http://bazaar.launchpad.net/~jderose/+junk/gst-examples/view/head:/video-player-1.0的代码,但它失败了AttributeError: 'gtk.gdk.Win32Window' object has no attribute 'get_xid'

我找到了测试 get_xid 并将其粘贴到此处的最少代码:-

import gi
gi.require_version("GdkX11", "3.0")
gi.require_version('Gtk', '3.0')
from gi.repository import GdkX11, Gtk, GstVideo

class App:
    def __init__(self):
        win = Gtk.Window()
        win.resize(400, 400)
        win.connect('delete-event', Gtk.main_quit)

        da = Gtk.DrawingArea()
        win.add(da)
        win.show_all()
        import pdb;pdb.set_trace()
        print da.get_property('window').get_xid()

if __name__ == "__main__":
    App()
    Gtk.main()

AttributeError: 'gtk.gdk.Win32Window' object has no attribute 'get_xid'

理想情况下,如果我已经导入GdkX11,那么窗口对象应该有 get_xid,但它不适用于 windows7 环境,看起来GdkX11不适合 windows 用户。请建议我应该如何解决这个问题。

4

1 回答 1

0

在 Windows 机器上, get_xid() 将导致您看到的问题。

以下答案中提供了一种解决方法:Get the window handle in PyGI

于 2017-01-27T06:53:20.230 回答