파이썬[Python]: kivy - InstructionGroup 클래스
kivy.graphics 모듈 - InstructionGroup 클래스(class)
/// 설명
Instruction의 그룹을 형성합니다.
참고: graphics 모듈 목록
※ 형식
InstructionGroup(**kwargs)
reference
https://kivy.org/doc/stable/api-kivy.graphics.html
참고: graphics 모듈 목록
※ 형식
InstructionGroup(**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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | import kivy kivy.require('2.0.0') from kivy.app import App from kivy.core.window import Window from kivy.graphics import Color, Rectangle, Fbo, \ InstructionGroup from kivy.uix.widget import Widget Window.clearcolor = (1, 1, 1, 1) Window.size = (563, 1001) Window.top, Window.left = 30, 2900 class FantasticApp(App): def build(self): w = Widget() rect_size = (100, 100) a = InstructionGroup() a.add(Color(1, 0, 0, 0.3)) a.add(Rectangle(pos=w.pos, size=rect_size)) b = InstructionGroup() b.add(Color(0, 1, 0, 0.3)) b.add(Rectangle(pos=(100, 100), size=rect_size)) c = InstructionGroup() c.add(Color(0, 0, 1, 0.3)) c.add(Rectangle(pos=(200, 200), size=rect_size)) d = InstructionGroup() d.add(Color(1, 1, 0, 0.3)) d.add(Rectangle(pos=(300, 300), size=rect_size)) e = InstructionGroup() e.add(Color(1, 0, 1, 0.3)) e.add(Rectangle(pos=(400, 400), size=rect_size)) f = InstructionGroup() f.add(Color(0, 1, 1, 0.3)) f.add(Rectangle(pos=(500, 500), size=rect_size)) [w.canvas.add(group) for group in [a, b, c, d, e, f]] return w FantasticApp().run() | cs |
/// 출력
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
댓글
댓글 쓰기