我正在使用VLC作爲播放器後端,在Python和PyGTK中使用簡單的視頻播放器。我想在gtk.DrawingArea中顯示視頻圖像,因此,在Linux中,我使用builder.get_object('drawingarea1')。window.xid來獲取DrawingArea小部件的XID。在Windows中,根據文檔,我不得不使用builder.get_object('drawingarea1')。window.handle,但是當我開始播放視頻文件時,它會在整個窗口中播放,而不是在gtk中播放。繪圖區。我開始挖掘發現發生了什麼,我發現從builder.get_object('mainWindow')。window.handle檢索到的數字與builder.get_object('drawingarea1')。window.handle相同。這是獲取小部件處理程序的正確方法,還是我做錯了什麼?在Windows上獲取gtk.gdk.window.handle
回答
我不確定你做了什麼沒有一個例子,但我做了一些搜索,發現這個問題和可能的答案http://python.6.n6.nabble.com/gtk-DrawingArea-handle-id-on-win32-bug-td1943074.html。並附上一個例子。他提供的鏈接http://library.gnome.org/devel/gtk/2.18/gtk-migrating-ClientSideWindows.html已不存在,但我找到了更新後的鏈接http://developer.gnome.org/gtk/2.24/gtk-migrating-ClientSideWindows.html。本質上,它似乎你必須調用
drawingarea.window.ensure_native()
使
drawingarea.window.handle
屬性返回繪圖區的正確原生手柄
Linux的一些屬性
drawingarea.window.xid
自動調用
drawingarea.window.ensure_native()
但
drawingarea.window.handle
不會爲你做這個。
我希望這會有所幫助。
謝謝,這對我有用。另外,我還有一個問題:如果我隱藏播放器的窗口並再次顯示(這是「隱藏到系統托盤」功能),那麼視頻將再也不會出現,直到我銷燬gtk.Drawingarea並重新創建它。這裏可能是什麼問題? – ov1d1u 2012-04-01 16:13:01
說實話,我不知道。你有沒有嘗試再次調用drawingarea.window.ensure_native()?這就是我能想到的。也可能是句柄被隱藏時被銷燬,因此在調用ensure_native()之後可能需要查看句柄是否相同,並確保將句柄指向了正確的句柄。只是一個受過教育的猜測。讓我知道我說的是否有效。 – 2012-04-01 20:11:01
在隱藏視頻窗口之前和之後,句柄ID似乎保持不變。再次調用ensure_native()沒有幫助。我問過VLC論壇,他們說這是一個GTK問題......所以我想我必須對此感到滿意。 – ov1d1u 2012-04-01 22:12:06
- 1. 獲取Rspec + autotest在windows上工作
- 2. PHP - 獲取MSSQL在Windows上工作10
- 3. 在Windows上獲取DNS服務器
- 4. 在windows上獲取CPU溫度
- 5. 在Windows上獲取PDF的預覽JPEG?
- 6. 在Windows Mobile上獲取按鈕6
- 7. NodeJs:在Windows上獲取MyDocuments路徑
- 8. 在Windows上獲取Aspen和Gheat工作
- 9. 在Windows上獲取OpenGL設置(mingw32?)
- 10. 在Windows上獲取進程內存
- 11. 獲取Nant.MailLogger在Windows上運行2008
- 12. 在Windows Phone上獲取用戶反饋
- 13. 在Windows 8上獲取DirectShow示例8
- 14. 在Windows上獲取鍵盤語言
- 15. 如何在Windows上獲取rsync命令?
- 16. 在Windows Phone上使用HttpWebRequest獲取xml
- 17. 在Windows的非英文版上獲取Windows用戶帳戶
- 18. 如何在Windows Phone上獲取Windows Azure表實體?
- 19. FTP獲取在Windows上的作品,但不是在Linux上
- 20. 獲取Windows版在VB.NET
- 21. 獲取這個詞在Windows
- 22. 在Windows Forms中獲取System.Windows.Forms.Window
- 23. 獲取CivicAddress在Windows Phone 8.1
- 24. 獲取java.lang.NoClassDefFoundError在Windows 8
- 25. 獲取在Windows,OSX和Linux
- 26. Windows上的Selendroid 0.5.1:獲取INSTRUMENTATION_FAILED
- 27. 獲取Windows上的RAM字節總數
- 28. 在C++上的Windows客戶端上獲取Kerberos tgt
- 29. 在Windows上運行的Apache上獲取MySQL路徑
- 30. 如何在IIS7上獲取Windows用戶webApp在IIS7 +
只是預感,但嘗試將繪圖區放在GtkEventBox上。 – 2012-02-13 21:24:15