omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    How to stop Scene

    Pythonista
    2
    2
    1192
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • upwart
      upwart last edited by

      Maybe a stupid question, but I can't find how to stop a Scene based program. Of course, there's the cross at the upper righthand corner, but how can I force a stop by code?

      1 Reply Last reply Reply Quote 0
      • abcabc
        abcabc last edited by

        use self.view.close()

        import scene, ui
        
        class MyScene(scene.Scene):
            def setup(self):
                self.test_label = scene.LabelNode('Hello World', 
                    position=self.size/2.0, parent=self)
                self.close_label = scene.LabelNode('Close scene',
                    position=(self.size[0]/2, self.size[1]/2-100),
                    parent=self)
                    
            def touch_began(self, touch):
                if touch.location in self.close_label.frame:
                    self.view.close()
                   
        scene.run(MyScene())
        
        
        1 Reply Last reply Reply Quote 1
        • First post
          Last post
        Powered by NodeBB Forums | Contributors