【发布时间】:2021-10-20 18:41:26
【问题描述】:
我的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)
当我运行它时:
【问题讨论】:
-
请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。
-
我无法重现将
tab_1替换为根Tk()窗口的问题。看起来您可能正在使用ttk.Notebook,这可能与问题有关。请提供minimal reproducible example,因为您问题中当前代码的 sn-p 中没有足够的信息。 -
条目
manual_entry太长(100 个字符宽度),因此按钮被压缩为零宽度。尝试将manual_entry.pack(side=RIGHT)更改为manual_entry.pack()。
标签: python tkinter tkinter-button