ตัวอย่าง
Code: Select all
import tkinter as tk
class sum(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
self.entry = tk.Entry(self)
self.button = tk.Button(self, text="Input", command=self.on_button)
self.button.pack()
self.entry.pack()
def on_button(self):
print(self.entry.get())
app = sum()
app.mainloop()
สามารถพิมพ์แล้วเก็บค่าใว้ได้