一种方法是使用顶级小部件。一点也不乱。无论如何,要将输入框放置在所需的位置,必须首先设置主(根)帧的尺寸和位置:from Tkinter import *
import ttk
root = Tk()
root.lift()
w = 300; h = 200; x = 10; y = 10
root.geometry('%dx%d+%d+%d' % (w, h, x, y))
Label(root, text = "Menu Choices:").grid(row=1, column =0)
Label(root, text='1. Baloney and cheese').grid(row=2, column=0, pady=4)
Label(root, text='2. Roast chicken and gravy').grid(row=3, column=0, pady=4)
Label(root, text='3. Pear salad').grid(row=4, column=0, pady=4)
Label(root, text='4. Cateloupe and brocoli soup').grid(row=5, column=0, pady=4)
def store_entry():
print "Entry stored as "+ent.get()
def exit_entry():
print "Entry cancelled"