回复: [wxPython-users] 回复: [wxPython-users] Can I have ListCtrl accept a dictionary with non-integer keys?
光华 陶
artman328 at yahoo.com.cn
Mon Nov 13 16:34:14 PST 2006
raw_uuid = uuid.UUID(hex(yourlistctrl.GetItemData(your_selected_idx)[2:-1])
that's what i have try out. :)
光华 陶 <artman328 at yahoo.com.cn> 写道: import uuid
#your data:
data = dict{}
data[id]=[...] #id is an uuid
#then you can SetItemData:
yourlistctrl.SetItemData(item, int(id)) # convert the id to int
#if you wanna get the raw uuid from the item data, just covert the int id to uuid:
raw_uuid = uuid.UUID(str(yourlistctrl.GetItemData(your_selected_idx))
--that's what I can guess, haven't try it out :)
Artman
TiNo <tinodb at gmail.com> 写道:
I have information that I want to display in lists that is relatively
linked by uuids. uuid's are strings. Is there a way (subclassing or
overriding?) to have ListCtrl accept a dictionary with those uuids as
keys?
Error message I get when I try to do what I want (only copied relevant part):
File "F:\Python\xmltodb\listctrl.py", line 36, in __init__
self.PopulateList(values)
File "F:\Python\xmltodb\listctrl.py", line 87, in PopulateList
self.list.SetItemData(index, key)
File "P:\Python24\lib\site-packages\wx-2.6-msw-ansi\wx\_controls.py",
line 4669, in SetItemData
return _controls_.ListCtrl_SetItemData(*args, **kwargs)
TypeError: argument number 3: a 'number' is expected,
'str(9cabaf89-a0df-4242-98dd-ffbfbe126c40)' is received
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
---------------------------------
抢注雅虎免费邮箱-3.5G容量,20M附件!
---------------------------------
抢注雅虎免费邮箱-3.5G容量,20M附件!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/20061114/71b3368b/attachment.htm
More information about the wxpython-users
mailing list