coding

GUI tkinter Label, Button

유로파물고기 2021. 5. 13. 11:04
반응형

ttk: themed tk (개선된 tk)

 

# tkinter 위젯 종류

Label, Message

Entry, Text

Button, CheckButton, ComboButton

Listbox, Combobox

 

Scale : 슬라이스바

Scrollbar 

 

Toplevel : Window

Menu,Menubutton

Frame

Canvas

 

import tkinter as tk
from tkinter import ttk

def clickme():
    label1.configure(text="버튼이 클릭되었습니다.")
    button1.configure(text="clicked")
    label1.configure(foreground="blue", background="yellow")


win = tk.Tk()
win.title("python")
# window size
win.geometry("200x300+400+300") # 너비, 높이, x , y

# lable
label1 = ttk.Label(win, text="내용")

# 위젯 배치
# pack: 순서대로
# grid: (col, row)
#label1.pack()
label1.grid(column=0, row=0)

# button
button1 = ttk.Button(win,text="클릭", command=clickme)
#button1.pack()
button1.grid(column=1,row=0)

win.mainloop()

 

'coding' 카테고리의 다른 글

sqlite3 사용하기  (0) 2021.07.27
APPLICATION / WINDOW  (0) 2021.05.14
Kotlin 기초정리2  (0) 2021.04.03
Kotlin 기초1 정리  (0) 2021.03.18
git 기능~버전관리  (0) 2021.02.09