파이썬[Python]: kivy - DampedScrollEffect 클래스
kivy.effects.dampedscroll 모듈 - DampedScrollEffect 클래스(class)
/// 설명
콘텐츠의 마지막 부분에서 바운드 할 경우 천천히 되돌립니다.
참고: animation to gesture 모듈 목록
※ 형식
DampedScrollEffect(**kwargs)
reference
https://kivy.org/doc/stable/api-kivy.effects.dampedscroll.html
참고: animation to gesture 모듈 목록
※ 형식
DampedScrollEffect(**kwargs)
reference
https://kivy.org/doc/stable/api-kivy.effects.dampedscroll.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 | import kivy kivy.require('2.0.0') from kivy.app import App from kivy.core.window import Window from kivy.effects.dampedscroll import DampedScrollEffect from kivy.uix.gridlayout import GridLayout from kivy.uix.button import Button from kivy.uix.scrollview import ScrollView Window.clearcolor = (1, 1, 1, 1) Window.size = (563, 1001) Window.top, Window.left = 30, 700 class FantasticApp(App): def build(self): gl = GridLayout(cols=1, size_hint_y=None) gl.bind(minimum_height=gl.setter('height')) for i in range(30): bt = Button(text=f'ScrollView_{i}', size_hint_y=None, height=50) gl.add_widget(bt) sv = ScrollView(bar_color=(.5, .1, .1, 1), bar_width=5) sv.effect_y = DampedScrollEffect() sv.add_widget(gl) return sv FantasticApp().run() | cs |
/// 출력
* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)
– 당신을 응원합니다. –
댓글
댓글 쓰기