【发布时间】:2016-03-28 03:01:15
【问题描述】:
使用 Tkinter 运行 python 2.7.8。我有一个移动列表框项目的功能。此功能有效。但是,我还想移动列表框选择(即,正在移动的东西的指示器)。
我的班次函数基于this thread。 这是之前的清单: before_shift_function 并在调用函数后: after_shift_function
如何将选择“从属于”我的班次?谢谢
def shift_sel_up(seltext):
posList = data_list.curselection()
if not posList: # exit if nothing selected
return
for pos in posList:
if pos == 0:
my_status_update('Item at top of list.')
continue
text = data_list.get(pos)
data_list.delete(pos)
data_list.insert(pos -1, text)
# new, doesn't work - [from here][4].
# data_list.selection_clear()
data_list.selection_set(pos)
return
【问题讨论】:
标签: python-2.7 select tkinter listbox