示例#1
0
#!/usr/bin/env python

from tkinter import Label, Button, END
from tkinter.tix import Tk, Control, ComboBox

top = Tk()
top.tk.eval('package require Tix')

lb = Label(top, text = 'Animals (in parirs; min : pair, max : dozen)')
lb.pack()

ct = Control(top, label = 'Number:', integer = True, max = 12, min = 2, value = 2, step = 2)
ct.label.config(font = 'Helvetica -14 bold')
ct.pack()

cb = ComboBox(top, label = 'Type:', editable = True)
for animal in ('dog', 'cat', 'hamster', 'python'):
    cb.insert(END, animal)
cb.pack()

qb = Button(top, text = 'Quit', command = top.quit, bg = 'red', fg = 'white')
qb.pack()

top.mainloop()