请帮助修复脚本。
from tkinter import *
colors = ['red', 'white', 'blue']
def packbox(root):
Label(root, text='Pack').pack()
for color in colors:
row = Frame(root)
lab = Label(row, text=color, relief=RIDGE, width=25)
ent = Entry(row, bg=color, relief=SUNKEN, width=50)
row.pack(side=TOP, expand=YES, fill=BOTH)
lab.pack(side=LEFT, expand=YES, fill=BOTH)
ent.pack(side=RIGHT, expand=YES, fill=BOTH)
root = Tk()
packbox(root)
mainloop()
我想在标签小部件的左边对齐文本
锚定用于定义相对于参照点放置文字的位置。
下面是可能的常量列表,可用于锚定属性。
下面将打开一个新窗口,其中包含每个按钮的文本whitebutton、redbutton和 蓝色按钮按下时,按钮都左对齐,按每个按钮的方法 还有一个名为“关闭窗口”的附加按钮,用于关闭每次单击按钮时打开的新窗口。
试试这个
相关问题 更多 >
编程相关推荐