Tkinter を使用して、ユーザーが体重をポンド単位で入力し、体重をキロ単位で出力するプログラムを作成しています。
ユーザーからのコンテンツを取得する際に問題が発生してEntry
います。私はポンドをキロで計算していclicked1
ます.
誰かがそこにエントリ入力を取得する方法を教えてもらえますか?
from Tkinter import *
import tkMessageBox
class App(object):
def __init__(self):
self.root = Tk()
self.root.wm_title("Question 7")
self.label = Label (self.root, text= "Enter your weight in pounds.")
self.label.pack()
self.entrytext = StringVar()
Entry(self.root, textvariable=self.entrytext).pack()
self.buttontext = StringVar()
self.buttontext.set("Calculate")
Button(self.root, textvariable=self.buttontext, command=self.clicked1).pack()
self.label = Label (self.root, text="")
self.label.pack()
self.root.mainloop()
def clicked1(self):
input = 3423 #I would like the user input here.
self.label.configure(text=input)
def button_click(self, e):
pass
App()