В настоящее время я сталкиваюсь с проблемой создания калькулятора в 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)
У меня недостаточно репутации для встраивания изображения, поэтомуВот ссылки до и после:
до
После