import tkinter as tk
root = tk.Tk()
root.title("숫자")
root.geometry("680x680")
root.resizable(False, False)
def getTextInput():
Button=textExample.get()
print(Button)
f = open("text.txt", "a")
f.write(Button)
def ff(input):
data = textExample.get()
data += input
textExample.delete(0, "end")
textExample.insert(0, data)
# textExample.insert(data)
#print(data)
b1 = tk.Button(root, text="1", command = lambda: ff(b1['text']))
b2 = tk.Button(root, text="2", command = lambda: ff(b2['text']))
b3 = tk.Button(root, text="3", command = lambda: ff(b3['text']))
b4 = tk.Button(root, text="4", command = lambda: ff(b4['text']))
b5 = tk.Button(root, text="5", command = lambda: ff(b5['text']))
b6 = tk.Button(root, text="6", command = lambda: ff(b6['text']))
b7 = tk.Button(root, text="7", command = lambda: ff(b7['text']))
b8 = tk.Button(root, text="8", command = lambda: ff(b8['text']))
b9 = tk.Button(root, text="9", command = lambda: ff(b9['text']))
b1.grid(row=0, column=0)
b2.grid(row=0, column=1)
b3.grid(row=0, column=2)
b4.grid(row=1, column=0)
b5.grid(row=1, column=1)
b6.grid(row=1, column=2)
b7.grid(row=2, column=0)
b8.grid(row=2, column=1)
b9.grid(row=2, column=2)
textExample=tk.Entry(root)
textExample.grid(row=3, column=1)
btnRead=tk.Button(root, height=1, width=10, text="Read",
command=getTextInput)
#btnRead.pack()
btnRead.grid(row=4, column=1)
root.mainloop()
top of page
실제 작동 상태를 확인하려면 라이브 사이트로 이동하세요.
210526
210526
댓글 0개
좋아요
댓글(0)
bottom of page