pmw_scrolledlistbox.py

来自「Python.Tkinter编程实例代码多多学习」· Python 代码 · 共 30 行

PY
30
字号
from Tkinter import *
import Pmw
root = Tk()
root.option_readfile('optionDB')
root.title('ScrolledListbox')
Pmw.initialise()

box = None

def selectionCommand():
    sels = box.getcurselection()
    if len(sels) == 0:
        print 'No selection'
    else:
        print 'Selection:', sels[0]

box = Pmw.ScrolledListBox(root, listbox_selectmode=SINGLE,
              items=('John Cleese', 'Eric Idle', 'Graham Chapman',
                     'Terry Jones', 'Michael Palin', 'Terry Gilliam'),
              labelpos=NW, label_text='Cast Members',
              listbox_height=5, vscrollmode='static',
              selectioncommand=selectionCommand,
	      dblclickcommand=selectionCommand,
	      usehullsize=1, hull_width=200, hull_height=200,)

box.pack(fill=BOTH, expand=1, padx=5, pady=5)

root.mainloop()

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?