본문 바로가기

개발자 모드/파이썬(python)

파이썬 python 텍스트, 엔트리 기초 예제 text, entrty

728x90
from tkinter import *

root =Tk()
root.title(" GUI")
root.geometry("640x480")

txt = Text(root,width =30, height =5)   #  여러줄 사용시 이용
txt.pack()

txt.insert(END, "글자리를 입력하세요") # 한줄 사용시 이용 etc ... Id, password 

e = Entry(root, width =30)
e.pack()
e.insert(0,"한줄만 입력하세요 ")

def btncmd() :
    print(txt.get("1.0",END))
    print(e.get())

    txt.delete("1.0",END)
    e.delete(0,END)


btn = Button(root, text ="클릭", command =btncmd)
btn.pack()




root.mainloop()
728x90