2016-11-06 80 views
0

信封 - python2.7,windows7的上GStreamer的1.0'gtk.gdk.Win32Window' 對象有沒有屬性 'get_xid'

我試圖在我的ENV運行從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沒有t用於windows用戶。請告訴我該如何解決這個問題。

+1

可能重複:http://stackoverflow.com/a/8012212/1513933 –

+0

這是特定於Windows,我想不同的解決方案將適用在這裏。 – AlokThakur

回答

0

在Windows機器上,get_xid()會導致您所看到的問題。

一種解決方法是在下面的答案提供:Get the window handle in PyGI

+0

而不是張貼鏈接作爲答案添加一些文本來解釋這個答案如何幫助OP在修復當前issue.Thanks –