信息:多重疑问,选择列表,多项选择列表
所有示例文件UI功能都由模块 appuifw_overview.py 提供
多重请求: appuifw.multi_query(label1,label2)
multi_query 函数创建 2 个对话框(2个输入区),如右边的屏幕截图。
1 2 3 4 | import appuifw data1,data2 = appuifw.multi_query(u"Type your first name:",u"Type your surname:") print data1 print data2 |
示例代码: multi_query.py
选择列表: appuifw.selection_list(choices=list,search_field=1)
1 2 3 4 5 6 7 8 9 10 | import appuifw # define the list of items (put a u in front - items must be written in unicode!) L = [u'cakewalk', u'com-port', u'computer', u'bluetooth', u'mobile', u'screen', u'keys'] # create the selection list index = appuifw.selection_list(choices=L , search_field=1) # use the result of the selection to trigger some action (here we just print something) if index == 0: print "cakewalk was selected" else: print "thanks for choosing" |
注意: search_field=1 可以在列表末尾显示一个搜索框。
search_field=0 则反之。
示例代码: selection_list.py
复选列表
两种不同样式:
- 使用复选框: appuifw.multi_selection_list(list , style=’checkbox’, search_field=1)
- 使用标记: appuifw.multi_selection_list(L , style=’checkmark’, search_field=1)
使用复选框
1
2
3
4# define the list of items (items must written in unicode! -> put a u in front)
L = [u'cakewalk', u'com-port', u'computer', u'bluetooth', u'mobile', u'screen', u'keys']
# create the multi-selection list with checkbox
index = appuifw.multi_selection_list(L , style='checkbox', search_field=1)
使用标记
1
2
3
4
5import appuifw
# define the list of items (items must written in unicode! -> put a u in front)
L = [u'cakewalk', u'com-port', u'computer', u'bluetooth', u'mobile', u'screen', u'keys']
# create the multi-selection list with checkmark
tuple = appuifw.multi_selection_list(L , style='checkmark', search_field=1)
0 Responses to “弹出菜单和选择列表”