카테고리 없음

[python] tkinter / Button 속성

working for you 2021. 7. 15. 13:02
반응형

[버튼옵션]

1. padx / padxy  : 버튼사이즈

2. command : 버튼함수 호출(클릭시 이벤트)

3. fg : 글자색상변경

4. bg : 버튼배경색상 변경 ('white', #000000 등등)

1
2
3
4
5
6
7
8
9
10
11
12
from tkinter import *
 
root = Tk()
 
def myclick():
    myLabel = Label(root, text='여기여기')
    myLabel.pack()
 
button = Button(root,text='안녕', padx=50, command=myclick, fg='white', bg='#000000')
button.pack()
 
root.mainloop()
cs
반응형