我的Button没有出现在tkinker (Python)中。
以下是主要代码:
# Start Of Manual Scanner ------------------------------------
manual = LabelFrame(tab_1,
text="Manual")
manual.pack(side=LEFT)
main = Label(manual,
text="Manual Entry",
font=('Arial', 20))
main.pack(side=TOP)
manual_entry = Entry(manual,
width=100,
font=('Arial', 20))
manual_entry.pack(side=RIGHT)
place_order_BTN = Button(manual,
text="Add Item",
fg='black',
font=('Arial', 20),
width=20,
bg='#feffa3',
activeforeground='white',
activebackground='black',)
place_order_BTN.pack(pady=15)当我运行它时:

发布于 2021-10-21 01:49:10
该按钮实际上被打包在条目的左侧。但是,由于该条目有点长(100个字符的宽度),它会将按钮压缩为零宽度。
您可以将条目设置得更小一些:
manual_entry = Entry(manual,
width=30, # changed from 100 to 30
font=('Arial', 20))
manual_entry.pack(side=RIGHT)

或者将manual_entry.pack(side=RIGHT)更改为manual_entry.pack()。

https://stackoverflow.com/questions/69651422
复制相似问题