Skip to content
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

Displaying modal Scene from Scene that has no children gives max() arg is an empty sequence error #723

Open
weirdnik opened this issue Dec 2, 2023 · 2 comments

Comments

@weirdnik
Copy link

weirdnik commented Dec 2, 2023

This is quite simple problem in the scene.py.

Replication: I'm writing an app that will present a series of Scenes based on timing or user actions (mostly tapping to skip, like in the Stories on social apps). The app is managed by the base Scene that just sets the background colour and manages the timing in the did_evaluate_actions method. This base scene has no children. And when the Base.show_modal_scene(otherScene) is called it gives max() arg is an empty sequence, because the scene.py code assumes (line 125) that the base Scene that displays a modal has other children, as seen on the screenshot:
IMG_2800

Fix: add a check if for children existing:

other_scene.z_position = 1 + max(n.z_position for n in self.children) if self.children else 0

@cclauss
Copy link
Contributor

cclauss commented Dec 2, 2023

if self.children:
    self.present_model_scene(...

@weirdnik
Copy link
Author

weirdnik commented Dec 3, 2023

I did other workaround, but the points are:

  • nowhere in the docs it says that Scene should have children first to display a modal scene on top;
  • it would be an illogical design decision to make it that way;
  • the fix is trivial, I gave one at the end of my report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants