How to set multiple items into a GtkSelection for Treeview drag and drop

别说谁变了你拦得住时间么 提交于 2019-12-04 20:59:37

You could encode your tuple of 4 values into a single string. An easy way is to use json for that:

import json
data = ["string", "string2", True, 20]
string_variable = json.dumps(data)
#
# now pass string_variable through drag and drop
#
returned = json.loads(string_variable)

You could also use your own encoding scheme if importing json is not an option for you.

Please do a careful sanity check on the data you get this way. If you don't, some specially crafted string (passed from another program, say) might crash you program or worse.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!