Forum Archive

What this error

resserone13

Traceback (most recent call last):
File "/var/containers/Bundle/Application/F3A42D55-5CB1-4DC2-AFF5-5BE7BB053375/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/scene.py", line 161, in _setup_scene
self.setup()
File "/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/PPEasy/PPEasy.py", line 11, in setup
self.present_modal_scene(Lvl_1())
File "/var/containers/Bundle/Application/F3A42D55-5CB1-4DC2-AFF5-5BE7BB053375/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/scene.py", line 125, in present_modal_scene
other_scene.z_position = max(n.z_position for n in self.children) + 1
ValueError: max() arg is an empty sequence


from scene import *
import sound
import random
import math
A = Action

class MyScene (Scene):
    def setup(self):
        self.background_color = 'white'

        self.present_modal_scene(Lvl_1())





    def did_change_size(self):
        pass

    def update(self):
        pass

    def touch_began(self, touch):
        pass

    def touch_moved(self, touch):
        pass

    def touch_ended(self, touch):
        pass

class Lvl_1(Scene):
    def setup(self):

        self.main_node = Node(parent=self)

        self.bg_color = SpriteNode(color='blue', size=self.size/2, position=(self.size.w/2, self.size.h * 80), parent=self)

        self.name = LabelNode('tezt', ('Arial', 30), position=(self.size.w/2, self.size.h * 40), parent=self)

class Lvl_3(Scene):
    def setup(self):
        pass

class K_N95(Scene):
    def setup(self):
        pass    

class N95(Scene):
    def setup(self):
        pass

class Papr(Scene):
    def setup(self):
        pass

class Gowns(Scene):
    def setup(self):
        pass            

class Face_Shield(Scene):
    def setup(self):
        pass            

class Oxy(Scene):
    def setup(self):
        pass                                                    
class Alcohol(Scene):
    def setup(self):
        pass

class Bleach(Scene):
    def setup(self):
        pass

class Ammonia(Scene):
    def setup(self):
        pass

class k_n95(Scene):
    def setup(self):
        pass                                                    

if __name__ == '__main__':
    run(MyScene(), PORTRAIT, show_fps=False)

cvp

@resserone13 it seems that the reason is that your main scene is empty

resserone13

@cvp If I remove present Modal seen it works

cvp

@resserone13 so it works also

class MyScene (Scene):
    def setup(self):
        self.background_color = 'white'
        self.main_node = Node(parent=self)
        self.present_modal_scene(Lvl_1())
resserone13

@cvp right. It looks like I needed to add a node. Thanks as always. I’m Going to make a simple app real quick to explain the difference in the types of protective masks. I work at a hospital and you’d be surprised how many people are confused on which masks are for what. I’m not sure how I can actually get it into an app though. The app itself is just going to present pictures and texts. I wonder how hard it would be to package it up.

cvp

@resserone13 try, the line is the line that generates the error

class MyScene (Scene):
    def setup(self):
        self.background_color = 'white'
        try:
          print(max(n.z_position for n in self.children))
        except Exception as e:
          print(e)
        self.main_node = Node(parent=self)
        print(max(n.z_position for n in self.children))
        #self.present_modal_scene(Lvl_1())
cvp

@resserone13 said:

Going to make a simple app real quick to explain the difference in the types of protective masks.

Would like To help but Can't imagine how

resserone13

@cvp that sounds good. Once I get I done which should be in the next day or 2 I’ll post it on GitHub or the forum and let you know. It should be pretty simple. Each scene will have a title, a picture of the mask, and a description of when it should be used. I’ll let you know.

resserone13

@cvp I must’ve woke up too early this morning. I hate when things like this happen. I could’ve already made all the scenes and uploaded all the pictures but for some reason I’m having trouble with something simple again. I’m getting this error from a label note for my description. Extremely frustrating and a complete waste of time. Thankfully you guys always help.

Traceback (most recent call last):
File "/var/containers/Bundle/Application/F3A42D55-5CB1-4DC2-AFF5-5BE7BB053375/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/scene.py", line 161, in _setup_scene
self.setup()
File "/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/PPEasy/PPEasy.py", line 11, in setup
self.present_modal_scene(Lvl_1())
File "/var/containers/Bundle/Application/F3A42D55-5CB1-4DC2-AFF5-5BE7BB053375/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/scene.py", line 121, in present_modal_scene
other_scene._setup_scene(*self.size)
File "/var/containers/Bundle/Application/F3A42D55-5CB1-4DC2-AFF5-5BE7BB053375/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/scene.py", line 161, in _setup_scene
self.setup()
File "/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/PPEasy/PPEasy.py", line 45, in setup
self.discription = LabelNode(f'{self.text}', ('Arial', 30), position=(self.size.w/2, self.size.h * 0.35), color='black', parent=self)
File "/var/containers/Bundle/Application/F3A42D55-5CB1-4DC2-AFF5-5BE7BB053375/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/scene.py", line 265, in init
self.update_texture()
File "/var/containers/Bundle/Application/F3A42D55-5CB1-4DC2-AFF5-5BE7BB053375/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/scene.py", line 294, in update_texture
self.texture = Texture(img)
ValueError: Could not load image


from scene import *
import sound
import random
import math
A = Action

class MyScene (Scene):
    def setup(self):
        self.background_color = '#adc9ff'
        self.main_node = Node(parent=self)      
        self.present_modal_scene(Lvl_1())





    def did_change_size(self):
        pass

    def update(self):
        pass

    def touch_began(self, touch):
        pass

    def touch_moved(self, touch):
        pass

    def touch_ended(self, touch):
        pass

class Lvl_1(Scene):
    def setup(self):

        self.node = Node(parent=self)

        self.bg_color = SpriteNode(color='#b1f5ff', size=self.size, position=(self.size.w/2, self.size.h/2), parent=self)

        self.name = LabelNode('Level 1', ('Arial', 30), position=(self.size.w/2, self.size.h * 0.85), color='black', parent=self)

        self.mask = SpriteNode('emj:Medical_Mask', position=self.size/2, scale=1, parent=self)

        self.text = 'This is a level 1 mask. This mask is suitable for general areas such as lobbies or the cafeteria. It is NOT recommended to ware a Level 1 while working with patients'     

        self.discription = LabelNode(f'{self.text}', ('Arial', 30), position=(self.size.w/2, self.size.h * 0.35), color='black', parent=self)





cvp

I was still busy to debug, too long text...

cvp

@resserone13 try

        self.text = 'This is a level 1 mask. \nThis mask is suitable for general\n areas such as lobbies or the cafeteria. \nIt is NOT recommended to ware a Level 1 \nwhile working with patients'     

ccc

wear a mask, not ware a mask

mikael

@resserone13, for your app, this could work really well:

PageControl