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.0205 sec