(Window) 만드는법 ¶
~cpp from Tkinter import * root = Tk() root.mainloop()
만드는법 ¶
만든 GUI객들 다.(그냥 root 된다.)
나 다고 보면된다.
나 다고 보면된다.
~cpp frame = Frame(root) frame.pack()
GUI객들 만들 pack 보게 된다.
Packer 동리 ¶
pack() 러가 다.
side=LEFT # 렬방(RIGHT, TOP, BOTTOM)
after=button1 # pack려는 객를 button1바로뒤 만들 다.
before=button1 # pack려는 객를 button1바로 만들 다.
fill=X # 객를 X기 맞 만들다. Y로 가능
padx=5, pady=5 # 각 객들 격 다.
ipadx=5, ipady=5 # 객내부 격 다.
anchor=NW # 객를 북로 . fill 대로 보꺼 같...
after=button1 # pack려는 객를 button1바로뒤 만들 다.
before=button1 # pack려는 객를 button1바로 만들 다.
fill=X # 객를 X기 맞 만들다. Y로 가능
padx=5, pady=5 # 각 객들 격 다.
ipadx=5, ipady=5 # 객내부 격 다.
anchor=NW # 객를 북로 . fill 대로 보꺼 같...
~cpp button.pack(side=LEFT, fill=X, padx=5, pady=10)렬 X만 기로 가로5, 로10로 만들라....
~cpp button.place(30, 30, width=70, height=25)
및 기를 로
데 력 ¶
데를 력는 박..
~cpp entry = Entry(frame) entry.insert(0, '') # 부 공 문 가 entry.pack(pady=5)
Label ¶
문를 는 객()...
textWrite = Label(frame, text="Hello World!")
textWrite.pack()
textWrite.pack()
단 ¶
반
~cpp button = Button(frame, text="Push Button", fg="red", command=frame.quit) button.pack(side=LEFT)
pack때 렬 방 다. 가능..
단 ¶
박모고 면 v가 된다.
~cpp var = IntVar() # 0 기값로 는 변 () 를 면 그값로 기됨. check = Checkbutton(frame, text="Check Button", variable=var, command=cb) check.pack() def cb(): if var.get() == 1: w.configure(text='Variable is Set') elif: w.configure(text='Variable is Reset')
command는 단를 렀때 는 를 다.
라디 단 ¶
동그란 모데 면 까만(?) 된다.
각 그룹 개만 다.
각 그룹 개만 다.
~cpp var = IntVar() radio1 = Radiobutton(frame, text="One", variable=var, value=1) radio2 = Radiobutton(frame, text="Two", variable=var, value=2) radio1.pack(anchor=w) radio2.pack(anchor=w)
같 그룹내 는 라디 단들 같 variable 공다.
(로 varivable 같면 같 그룹라고 봐는...???)
(로 varivable 같면 같 그룹라고 봐는...???)
radio1단를 면 var변 값 1되고, radio2단를 면 var변 값 2가된다.
Radiobutton indicatoron=0 면 라디모 모로 된다.
메뉴 ¶
롤 바 ¶
롤바는 대부 리박, (Canvas)과 께 된다.
~cpp scrollbar = Scrollbar(frame) scrollbar.pack(side=RIGHT, fill=Y)
()롤바를 결기 2가 다.
1. (객) yscrollcommand 를 롤바 set 메드 다.
2. 롤바 command를 yview 다.
1. (객) yscrollcommand 를 롤바 set 메드 다.
2. 롤바 command를 yview 다.
리 ¶
롤바를 가 리 ...
~cpp listbox = Listbox(frame, yscrollcommand=scrollbar.set) # 1 listbox.pack(side=LEFT, fill=BOTH) scrollbar.config(command=listbox.yview) # 2롤바는 yscrollcommand대 xscrollcommand, yview대 xview를 ..
디 ¶
다 문를 다. 다 나 미 가능. 또 다.
※Label 를 만 ..
※Label 를 만 ..
~cpp textArea = Text(frame, width=80, height=20) textArea.pack()
방법 ¶
~cpp textArea.insert(END, "Hello") textArea.insert(INSERT, "world") textArea.insert(1.0, "!!!!!") # 디 가는 방법 button = Button(textArea, text="Click") textArea.window_create(INSERT, window=button)
END문 문 막
INSERT는
는 라,
INSERT는
는 라,
window_create대 image_create를 단를 문 가 .
방법 ¶
~cpp textArea.deletet(1.0, END) # textArea.deletet(INSERT) # 문 textArea.deletet(button) # 단
기 ¶
~cpp contents = text.get(1.0, END)
문를 가다가 contents 변 다.
~cpp textArea.config(state=DISABLED)
를 기로 만듬.(state=NORMAL로 면 가능)
내기 ¶
~cpp index = textArea.index(INSERT)
index '1.17'과 같 값 리됨.