Button sizes for my Python Tkinter calculator

enter image description here

I am new to python and tkinter. Over the past couple of days, I looked and studied several manuals, and my first project was a calculator.

A little embarrassed somewhere along the line. If someone can tell me how I can make the button "0", fill in the gap between the ".". button. I would also like "+/-" to be evenly spaced with the rest of the column.

I saw in another question like this, the guy answered how

button1.config( height = WHATEVER, width = WHATEVER2 )

Since I have my buttons placed in a grid, can I implement this and how?

bttn_0 = Button(calc, text = "0")
bttn_0["command"] = lambda: sum1.num_press(0)
bttn_0.grid(row = 5, column = 0, pady = 5)

enter image description here

+5
source share
3 answers

F3AR3DLEGEND , , grid. columnspan, , .

bttn_0.grid(row = 5, column = 0, pady = 5, columnspan = 2)

. .

+3

".", columnspan 2. 4, ( sticky, ).

+/- , . +/-. sticky="ew", , ( : "" ).

+3
bttn_0 = Button(calc, text = "0", height = my_height, width = my_width)

To fill in the gap, just try a few different values ​​or calculate it based on the width of the window and each other width (in this line).

-2
source

All Articles