我正在尝试使用GObject Introspection(gi.repository
)将应用程序从gtk2迁移到gtk3。
我现在遇到的问题是在辅助功能方法中创建Atk.Relation
,如下所示:
from gi.repository import Atk
def atk_acc(obj, lbl):
atk_obj = obj.get_accessible()
atk_l = lbl.get_accessible()
relation_set = atk_l.ref_relation_set()
relation = Atk.Relation.new([atk_obj], 1, Atk.RelationType.LABEL_FOR)
relation_set.add(relation)
当我运行应用程序时,它会中断异常:
Traceback (most recent call last):
File "/home/erick/Desarrollo/git/canaima-instalador/canaimainstalador/main.py", line 237, in siguiente
CFG['w'].next('Metodo', Metodo, (CFG), PasoMetodo(CFG))
File "/home/erick/Desarrollo/git/canaima-instalador/canaimainstalador/pasos/metodo.py", line 63, in __init__
atk_acc(self.cmb_discos, self.lbl1)
File "/home/erick/Desarrollo/git/canaima-instalador/canaimainstalador/mod_accesible.py", line 37, in atk_acc
relation = Atk.Relation.new([atk_obj], 1, Atk.RelationType.LABEL_FOR)
File "/usr/lib/python2.7/dist-packages/gi/types.py", line 72, in constructor
return info.invoke(cls, *args, **kwargs)
TypeError: Expected Atk.Object, but got GObjectMeta
在ATK documentation中,Atk.Relation.new
的第一个参数是数组。
我在这里做错了什么?