2011-09-10 27 views
0

pygtk 2.24とglade 3を使用すると、コンボボックスに問題があります。私は、次のエラーメッセージコンボボックスでアイテムを選択するpygtk glade3

interface.py:94: Warning: unable to set property `text' of type `gchararray' from 
value of type `glong' 
gtk.main() 

を取得することでアイテムをクリックするとコンボボックスのための私のコードはここに

#get the combo box out of the builder and add items to it 
self.cbmoRepresentation = builder.get_object("cmbo_representation") 
self.iface_list_store = gtk.ListStore(gobject.TYPE_STRING) 
self.iface_list_store.append(["Row-Column"]) 
self.iface_list_store.append(["Row-Number"]) 
self.iface_list_store.append(["Number-Column"]) 
self.cbmoRepresentation.set_model(self.iface_list_store) 
cell = gtk.CellRendererText() 
self.cbmoRepresentation.pack_start(cell, True) 
self.cbmoRepresentation.add_attribute(cell, "text", 0) 
self.cbmoRepresentation.set_active(-1) 

すべてのヘルプは本当にいただければ幸いれる:)。

答えて

0

私は動作します(私は空き地を使用していない)、この持っている:だから私は右のタイプのものとすることがないように、あなたのself.cbmoRepresentationを疑う

liststore = gtk.ListStore(gobject.TYPE_STRING) 
combobox = gtk.ComboBox(liststore) 
cell = gtk.CellRendererText() 
combobox.pack_start(cell, True) 
combobox.add_attribute(cell, 'text', 0) 

を。 てみてください:

self.cbmoRepresentation = builder.get_object("cmbo_representation") 
    print type(self.cbmoRepresentation) 

をcbmoRepresentationの種類を検査します。

+0

出力されます。 – Harpy

関連する問題