I'm working with python and TkInter.
I need to place two buttons in a resizable screen that when the screen gets bigger, so do the buttons. I found how to do that in here.
I also found how the weight in grid work in here and got what I wanted:
In theory it works perfect, if I use weight 3 and 1 I should get a column 3 times bigger then the second, if I use 1 and 1 I get 50% each...
My problem is when the text of one button is bigger then the other. I want my buttons to stay with 50% each and it's not what I'm getting:
My code is:
class MyGUI:
def __init__(self, master):
self.master = master
self.btn1 = Button(master, text='X')
self.btn2 = Button(master, text='XXXXX')
self.btn1.grid(row=0, column=0, sticky=N+S+E+W)
self.btn2.grid(row=0, column=1, sticky=N+S+E+W)
for x in range(2):
Grid.columnconfigure(master, x, weight=1)
root = Tk()
my_gui = MyGUI(root)
root.mainloop()
So how do I make the buttons stay with 50% each regardless of the text in it?