我想在python 3中制作一个简单的测验程序,但我无法找到如何使按钮走完我想要的全部宽度。我正在使用python 3和TKinter模块来创建窗口和所有按钮。如何在Tkinter中设置按钮宽度(Python 3)
from tkinter import *
root = Tk()
que_labl = Label(root, text='Question')
choice1 = Button(root, text='Choice one')
choice2 = Button(root, text='Choice one plus one')
choice3 = Button(root, text='Choice 3')
choice4 = Button(root, text='Choice eight divided by 2')
que_labl.grid(row=0, columnspan=2)
choice1.grid(row=2, column=0, sticky=W)
choice2.grid(row=2, column=1, sticky=W)
choice3.grid(row=3, column=0, sticky=W)
choice4.grid(row=3, column=1, sticky=W)
root.mainloop()
的代码使一个窗口是这样的:
简单的谷歌搜索会给你正确的答案 – IsaacDj
问问你自己“sticky = W'做什么? –