私はPythonでTkinterを使って簡単なUIを作成しようとしています。グリッド内でウィジェットをサイズ変更することはできません。メインウィンドウのサイズを変更すると、入力ウィジェットとボタンウィジェットはまったく調整されません。Tkグリッドのサイズが正しく調整されない
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()
rowconfigureを追加して垂直展開も可能にする –