2012-08-06 34 views
3

我正在設計一個GUI python程序,我決定使用GTK + 3。爲什麼我的gi.repository.Gtk繼續使用GTK 2模塊?

在這裏閱讀一些文檔:http://python-gtk-3-tutorial.readthedocs.org/en/latest/index.html我知道我可以使用gi.repository.Gtk模塊作爲GTK + 3庫的API。

但是,當我試圖做到這一點,不斷警告我,這是使用GTK + 2模塊:

>>> import gi.repository.Gtk 
/usr/lib/python2.7/dist-packages/gi/overrides/Gtk.py:47: RuntimeWarning: 
You have imported the Gtk 2.0 module. Because Gtk 2.0 was not designed 
for use with introspection some of the interfaces and API will fail. 
As such this is not supported by the pygobject development team and 
we encourage you to port your app to Gtk 3 or greater. PyGTK is the 
recomended python module to use with Gtk 2.0 
warnings.warn(warn_msg, RuntimeWarning) 

我不知道如何解決這個問題?我怎麼能真的轉向使用GTK + 3?

+0

您使用GTK 3的Python綁定。您的系統上是否安裝了GTK 3.x?可能你已經安裝了GTK 2。 – 2012-08-06 18:49:49

+1

需要更多信息,比如你的操作系統,可能你還沒有安裝Gtk3 gir文件。 – Havok 2012-08-07 03:24:04

+0

我很確定GTK2和GTK3庫都安裝在我的系統上......但是有沒有任何配置文件設置用於python綁定的默認庫?我正在使用Ubuntu Linux 12.04 ... – 2012-08-08 16:40:41

回答

4

檢查您已經安裝了GTK + 3的開發包在你的情況,與Ubuntu 12.04,你應該已經安裝libgtk-3-dev

+0

這很有效...對不起,這麼晚了,謝謝! – 2012-08-24 03:05:39

相關問題