python listbox多列_python3可用的多列列表MultiListbox

本文介绍了一个Python实现的多列列表框组件MultiListbox,它结合了Scrollbar,提供了键盘导航、选择、滚动等操作。通过定义_move方法处理上移、下移、翻页和滚到末尾的操作,_select方法处理鼠标点击选择,以及插入、删除、获取选中项等基本功能。
摘要由CSDN通过智能技术生成

', lambda e, s=self: s._move (-1, MOVE_TOEND))

self.bind ('', lambda e, s=self: s._move (+1, MOVE_TOEND))

frame = Frame(self); frame.pack(side=LEFT, fill=Y)

Label(frame, borderwidth=1, relief=RAISED).pack(fill=X)

sb = Scrollbar(frame, orient=VERTICAL, command=self._scroll)

sb.pack(expand=YES, fill=Y)

self.lists[0]['yscrollcommand']=sb.set

def _move (self, lines, relative=0):

"""

Move the selection a specified number of lines or pages up or

down the list. Used by keyboard navigation.

"""

selected = self.lists[0].curselection()

try:

selected = list(map(int, selected))

except ValueError:

pass

try:

sel = selected[0]

except IndexError:

sel = 0

old &

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值