首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >有人知道为什么我的tkinter按钮不能渲染吗?

有人知道为什么我的tkinter按钮不能渲染吗?
EN

Stack Overflow用户
提问于 2019-03-27 05:59:21
回答 1查看 159关注 0票数 0

这是在GitHub上的一个python项目中,我正在为Magic8Ball模拟制作一个图形用户界面。我似乎不能使用.pack()函数,或者我的窗口在没有实例化的情况下永远加载。

When created

When I click a button the text appears

window = Tk()
window.configure(bg="black")
window.title("Magic 8 Ball")
Label(window, text="Ask the Magic 8 Ball the question on your mind or enter X to exit: ", bg="black", fg="white")\
    .grid(row=0, column=0)


# Create entry box to type question
entrybox = Entry(window, width=30, bg="white")
entrybox.grid(row=1, column=0)


# Create output box at below buttons
output = Text(window, bg="white", fg="black", width=40, height=5)
output.grid(row=4, column=0)


# Create 4 button: Ask, Clear, Play Again, Quit
button_frame = Frame(window)
button_frame.configure(bg="black")
button_frame.grid(row=2, column=0)

#button_frame.pack(fill=X, side=BOTTOM)
Button(button_frame, text="Ask", width=10, bg="black", fg="white", command=click).grid(row=2, column=0)
Button(button_frame, text="Clear", width=10, command=clear).grid(row=2, column=1)
Button(button_frame, text="Play Again", width=10,command=repeat).grid(row=3, column=0)
Button(button_frame, text="Quit", width=10, command=close).grid(row=3, column=1)


window.mainloop()
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55366795

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档