(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' 리됨.