我目前在使用tkinter制作计算器时遇到问题。我有一堆按钮,上面有个标签,每按一次该按钮都会更改一次。问题在于,每当标签变长时,它似乎就会增加每个按钮的x填充。
这是我的按钮代码
one = Button(master, text = "1", highlightbackground = "black", command = commands.onefunc)
one.grid(row = 3, column = 1)
two = Button(master, text = "2", highlightbackground = "black", command = commands.twofunc)
two.grid(row = 3, column = 2)
three = Button(master, text = "3", highlightbackground = "black", command = commands.threefunc)
three.grid(row = 3, column = 3)
four = Button(master, text = "4", highlightbackground = "black", command = commands.fourfunc)
four.grid(row = 4, column = 1)
five = Button(master, text = "5", highlightbackground = "black", command = commands.fivefunc)
five.grid(row = 4, column = 2)
six = Button(master, text = "6", highlightbackground = "black", command = commands.sixfunc)
six.grid(row = 4, column = 3)
和我的标签代码
equationLable = Label(master, text = equationText, fg = "red", bg = 'black')
equationLable.grid(row = 1, column = 2)
我没有足够的声誉来嵌入图像,因此这里是前后的链接: