ドキュメントを見てきましたが、Tkinter を使用して変数を設定する方法について混乱しています。
通常、次のようなスクリプトを使用して変数を設定します。
nb=5
path='/Users/ashleighclayton/Files
navg=24
sdthresh=25
absstepthresh=100
ただし、GUI を使用してこれらの値を設定できるようにしたいと考えています。現時点では、この GUI を構築していますが、単純に見えますが、これを実装するのに苦労しています。(また、ほとんどの場合、文字列ではなく整数であることに注意してください)
class Application(Frame):
def exc(self):
execfile('currentmethod merlin.py',{'nb':nb,'path':path, 'navg':navg, 'sdthresh':sdthresh, 'absstepthresh':absstepthresh})
def exe(self):
execfile('new method merlin.py',{'nb':nb,'path':path, 'navg':navg, 'sdthresh':sdthresh, 'absstepthresh':absstepthresh} )
numblades=IntVar()
def createWidgets(self):
self.QUIT = Button(self)
self.QUIT["text"] = "QUIT"
self.QUIT["fg"] = "red"
self.QUIT["command"] = self.quit
self.QUIT.pack({"side": "left"})
self.CRTM = Button(self)
self.CRTM["text"] = "CRTM",
self.CRTM["command"] = self.exc
self.CRTM.pack({"side": "left"})
self.ERTM = Button(self)
self.ERTM["text"] = "ERTM",
self.ERTM["command"] = self.exe
self.ERTM.pack({"side": "left"})
# this is what I attempted, but I'm unsue how to set the input as the variable.
self.nb = Entry(self)
self.nb.pack(side = RIGHT)
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
self.createWidgets()
root = Tk()
app = Application(master=root)
app.mainloop()
root.destroy()
申し訳ありませんが、私は Tkinter を初めて使用するので、どんな助けも本当に感謝しています。関連するドキュメントを教えてください。