please help to fix the script.
JavaScript
x
17
17
1
from tkinter import *
2
colors = ['red', 'white', 'blue']
3
4
def packbox(root):
5
Label(root, text='Pack').pack()
6
for color in colors:
7
row = Frame(root)
8
lab = Label(row, text=color, relief=RIDGE, width=25)
9
ent = Entry(row, bg=color, relief=SUNKEN, width=50)
10
row.pack(side=TOP, expand=YES, fill=BOTH)
11
lab.pack(side=LEFT, expand=YES, fill=BOTH)
12
ent.pack(side=RIGHT, expand=YES, fill=BOTH)
13
14
root = Tk()
15
packbox(root)
16
mainloop()
17
I would like to align the text in the Label widget on the left edge
Advertisement
Answer
Try this
JavaScript
1
2
1
Label(root, text='Pack', anchor='w').pack(fill='both')
2