파이썬[Python]: kivy - Rotate 클래스
kivy.graphics 모듈 - Rotate 클래스(class)
/// 설명
축을 기준으로 회전을 시킵니다.
참고: graphics 모듈 목록
※ 형식
Rotate(*args, **kwargs)
reference
https://kivy.org/doc/stable/api-kivy.graphics.html
참고: graphics 모듈 목록
※ 형식
Rotate(*args, **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 | import kivy kivy.require('2.0.0') from kivy.app import App from kivy.core.window import Window from kivy.core.text import Label as CLabel from kivy.uix.floatlayout import FloatLayout from kivy.graphics import Color, Rectangle, Rotate, Callback Window.clearcolor = (1, 1, 1, 1) Window.size = (563, 1001) Window.top, Window.left = 30, 2900 class FantasticApp(App): def _my_callback(self, inst): self.fl.canvas.remove(self.rect1) self.fl.canvas.remove(self.rect2) self.rect1 = Rectangle(texture=self.cim.texture, pos=self.fl.center, size=self.cim.texture.size) self.fl.canvas.add(self.rect1) self.fl.canvas.add(Rotate(angle=45, origin=self.fl.center)) self.rect2 = Rectangle(texture=self.cim.texture, pos=self.fl.center, size=self.cim.texture.size) self.fl.canvas.add(self.rect2) def build(self): self.fl = fl = FloatLayout(size=Window.size) self.cim = cim = CLabel(text='____rotate____', font_size=30) cim.refresh() fl.canvas.add(Color(0, 0, 0, 1)) fl.canvas.add(Rotate(angle=45, origin=fl.center)) self.rect1 = Rectangle(texture=cim.texture, pos=fl.center, size=cim.texture.size) fl.canvas.add(self.rect1) fl.canvas.add(Rotate(angle=45, origin=fl.center)) self.rect2 = Rectangle(texture=cim.texture, pos=fl.center, size=cim.texture.size) fl.canvas.add(self.rect2) fl.canvas.add(Callback(self._my_callback)) return fl FantasticApp().run() | cs |
/// 출력
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
댓글
댓글 쓰기