2014-03-02 40 views

回答

2

QTreeWidgetItem construct旨在被傳遞多個串(沒有一個):

>>> s = QTreeWidgetItem(['someString', 'otherString']) 
>>> print(s.text(0)) 
someString 
>>> print(s.text(1)) 
otherString 

傳遞單個字符串對象'someString'是像傳遞一個序列與多個單字符串['s', 'o', 'm', 'e', 'S', 't', 'r', 'i', 'n', 'g']

如果你想傳遞一個字符串,包裹在列表或元組:

s = QTreeWidgetItem(['someString']) 
+0

啊,這就是了。感謝您及時的回覆! – UrbKr