U E D R , A S I H C RSS

방울뱀스터디/GUI

(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 ...
~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()


~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 ...???)

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 .

롤바를 ...
~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 ..
~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는
,

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

(Dialog Box)

(Canvas)

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:35
Processing time 0.0195 sec