pmw_combobox2.py
来自「Python.Tkinter编程实例代码多多学习」· Python 代码 · 共 29 行
PY
29 行
from Tkinter import *
import Pmw
root = Tk()
root.option_readfile('optionDB')
root.title('ComboBox 2')
Pmw.initialise()
choice = None
def choseEntry(entry):
print 'You chose "%s"' % entry
choice.configure(text=entry)
asply = ("The Mating of the Wersh", "Two Netlemeng of Verona", "Twelfth Thing", "The Chamrent of Venice", "Thamle", "Ring Kichard the Thrid")
choice = Label(root, text='Choose play', relief=SUNKEN, padx=20, pady=20)
choice.pack(expand=1, fill=BOTH, padx=8, pady=8)
combobox = Pmw.ComboBox(root, label_text='Play:', labelpos='wn',
listbox_width=24, dropdown=1,
selectioncommand=choseEntry,
scrolledlist_items=asply)
combobox.pack(fill=BOTH, expand=1, padx=8, pady=8)
combobox.selectitem(asply[0])
root.mainloop()
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?