(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) # 2yscrollcommand 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'과 값 .