1
我正在學習使用docs.python.org上列出的教程的Python GTK + 3。 更具體地說,我試圖執行基於ListBox的this demo program。Python GTK + 3 AttributeError:gi.repository.Gtk對象沒有屬性'ListBox'
當我試圖執行它,外殼返回以下錯誤:
File "listboxex.py", line 55, in <module>
win=ListBoxWindow()
File "listboxex.py", line 12, in __init__
listbox=Gtk.ListBox()
File "/usr/lib/python2.7/dist-packages/gi/module.py", line 313, in __getattr__
return getattr(self._introspection_module, name)
File "/usr/lib/python2.7/dist-packages/gi/module.py", line 134, in __getattr__
self.__name__, name))
AttributeError: 'gi.repository.Gtk' object has no attribute 'ListBox'
我要去哪裏錯了?另外我注意到shell正在使用Python 2.7執行我的代碼。我應該使用Python 3還是Python 3.3來執行我的代碼?我是一個Linux/Ubuntu新手,所以請告訴我如何!