Python kivy超出了最大递归深度

时间:2017-11-24 10:49:34

标签: python python-3.x kivy kivy-language

请查看我的代码。
运行此代码将导致递归错误 请告诉我是否有一种有效的写作方式,不会导致递归错误 此外,sys.setrecursionlimit(10000)导致崩溃。

def on_touch_move(self, touch):
    if touch.y > self.touch_pos_y:
        if self.anim_search_direction == 'up':
            self.anim_search_direction = 'down'
            anim_s_h_u_1 = Animation(opacity=0, duration=.6, t='out_expo')
            anim_s_h_u_2 = Animation(height=sp(40), duration=.6, t='out_expo')
            anim_s_h_u_3 = Animation(height=sp(40), duration=.6, t='out_expo')
            anim_s_h_u_4 = Animation(height=sp(40), duration=.6, t='out_expo')
            anim_s_h_u_1.start(self.a)
            anim_s_h_u_2.start(self.b)
            anim_s_h_u_3.start(self.c)
            anim_s_h_u_4.start(self.d)
    elif touch.y < self.touch_pos_y:
        if self.anim_search_direction == 'down':
            self.anim_search_direction = 'up'
            anim_s_h_u_1 = Animation(opacity=1, duration=.6, t='out_expo')
            anim_s_h_u_2 = Animation(height=sp(66), duration=.6, t='out_expo')
            anim_s_h_u_3 = Animation(height=sp(80), duration=.6, t='out_expo')
            anim_s_h_u_4 = Animation(height=sp(66), duration=.6, t='out_expo')
            anim_s_h_u_1.start(self.a)
            anim_s_h_u_2.start(self.b)
            anim_s_h_u_3.start(self.c)
            anim_s_h_u_4.start(self.d)

TRACEBAK就在这里并循环使用。

Traceback (most recent call last):
    File "kivy\properties.pyx", line 478, in kivy.properties.Property.__set__ (kivy\properties.c:5572)
    File "kivy\properties.pyx", line 516, in kivy.properties.Property.set (kivy\properties.c:6405)
    File "kivy\properties.pyx", line 571, in kivy.properties.Property.dispatch (kivy\properties.c:7105)
    File "kivy\_event.pyx", line 1225, in kivy._event.EventObservers.dispatch (kivy\_event.c:14035)
    File "kivy\_event.pyx", line 1131, in kivy._event.EventObservers._dispatch (kivy\_event.c:13193)
    File "C:\Python34\lib\site-packages\kivy\uix\scrollview.py", line 548, in _update_effect_bounds
 self._update_effect_y_bounds()
    File "C:\Python34\lib\site-packages\kivy\uix\scrollview.py", line 540, in _update_effect_y_bounds
 self.effect_y.value = self.effect_y.min * self.scroll_y
    File "kivy\properties.pyx", line 478, in kivy.properties.Property.__set__ (kivy\properties.c:5572)
    File "kivy\properties.pyx", line 516, in kivy.properties.Property.set (kivy\properties.c:6405)
    File "kivy\properties.pyx", line 571, in kivy.properties.Property.dispatch (kivy\properties.c:7105)
    File "kivy\_event.pyx", line 1225, in kivy._event.EventObservers.dispatch (kivy\_event.c:14035)
    File "kivy\_event.pyx", line 1131, in kivy._event.EventObservers._dispatch (kivy\_event.c:13193)
    File "C:\Python34\lib\site-packages\kivy\effects\dampedscroll.py", line 104, in on_value
self.scroll = self.value
    File "kivy\properties.pyx", line 478, in kivy.properties.Property.__set__ (kivy\properties.c:5572)
    File "kivy\properties.pyx", line 516, in kivy.properties.Property.set (kivy\properties.c:6405)
    File "kivy\properties.pyx", line 571, in kivy.properties.Property.dispatch (kivy\properties.c:7105)
    File "kivy\_event.pyx", line 1225, in kivy._event.EventObservers.dispatch (kivy\_event.c:14035)
    File "kivy\_event.pyx", line 1131, in kivy._event.EventObservers._dispatch (kivy\_event.c:13193)
    File "C:\Python34\lib\site-packages\kivy\uix\scrollview.py", line 576, in _update_effect_y
self.scroll_y = -sy

0 个答案:

没有答案