-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PageLayout on_touch_down doesn't check for length of self.children. Can get IndexError: list index out of range. #8563
Comments
PageLayout on_touch_down doesn't check for length of self.children. Can get IndexError: list index out of range. kivy#8563
On Startup: the variable Looks like the root of the issue might be in on_touch_move which changes |
Edit: The on_touch_down() method needs to be changed to consume the touch when the touch_down is accepted. from kivy.app import App
from kivy.lang import Builder
from kivy.uix.pagelayout import PageLayout
kv = """
MyPager:
<MyPager>:
Button:
text: "p1"
Button:
text: "p2"
"""
class MyPager(PageLayout):
def on_touch_down(self, touch):
print(f'on_touch_down: {self.page=} {touch.spos[0] > .95=}')
if touch.spos[0] > .95:
self.page = 0 if self.page == 1 else 1
return True
return super().on_touch_down(touch)
class AnalysisPageLayoutApp(App):
def build(self):
return Builder.load_string(kv)
AnalysisPageLayoutApp().run() |
ok thanks - closing ticket as "not planned" |
Software Versions
Describe the bug
Using PageLayout with on_touch_down() can generate an
IndexError: list index out of range
and crash the program using just standard user interactions.Expected behavior
A clear and concise description of what you expected to happen.
No crash.
To Reproduce
A short, runnable example that reproduces the issue with latest kivy master.
Code and Logs and screenshots
Python File:
Additional context
Add any other context about the problem here.
I have fixed this out of range issue by adding a check on the list length and will submit a pull request shortly.
The text was updated successfully, but these errors were encountered: