I am trying to write a simple ui with Tkinter in python, and I cannot force the widgets in the grid to resize. Whenever I resize the main window, login widgets and buttons are not configured at all.
Here is my code:
class Application(Frame): def __init__(self, master=None): Frame.__init__(self, master, padding=(3,3,12,12)) self.grid(sticky=N+W+E+S) self.createWidgets() def createWidgets(self): self.dataFileName = StringVar() self.fileEntry = Entry(self, textvariable=self.dataFileName) self.fileEntry.grid(row=0, column=0, columnspan=3, sticky=N+S+E+W) self.loadFileButton = Button(self, text="Load Data", command=self.loadDataClicked) self.loadFileButton.grid(row=0, column=3, sticky=N+S+E+W) self.columnconfigure(0, weight=1) self.columnconfigure(1, weight=1) self.columnconfigure(2, weight=1) app = Application() app.master.title("Sample Application") app.mainloop()
mjn12 source share