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