파이썬[Python]: kivy - ClearColor 클래스
kivy.graphics 모듈 - ClearColor 클래스(class)
/// 설명
윈도우를 정해진 색으로 변경합니다.
참고: graphics 모듈 목록
※ 형식
ClearColor(**kwargs)
reference
https://kivy.org/doc/stable/api-kivy.graphics.html
참고: graphics 모듈 목록
※ 형식
ClearColor(**kwargs)
reference
https://kivy.org/doc/stable/api-kivy.graphics.html
/// 예제
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | import kivy kivy.require('2.0.0') from kivy.app import App from kivy.core.window import Window from kivy.uix.floatlayout import FloatLayout from kivy.uix.button import Button from kivy.graphics import ClearBuffers, ClearColor, Rectangle from functools import partial Window.clearcolor = (.5, .0, .5, .1) Window.size = (563, 1001) Window.top, Window.left = 30, 800 class TestApp(App): def bt_pressed(self, bt_instance, fl): print(bt_instance) fl.canvas.add(ClearColor(0, .5, 0, 1)) fl.canvas.add(ClearBuffers()) def build(self): fl = FloatLayout() # using canvas rt = Rectangle(size=(200, 200), pos=(185, 410)) fl.canvas.add(rt) # button will be disappeared(Not really) bt = Button(text='ClearColor', size_hint=(.2, .2), on_press=partial(self.bt_pressed, fl)) fl.add_widget(bt) return fl TestApp().run() | cs |
/// 출력
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
댓글
댓글 쓰기