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.


    Disable stop button (X) in Scene

    Pythonista
    9
    12
    8805
    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

      I would like to disable the stop button (X) in the upper right hand corner. I found one solution on this forum, but that doesn't seem to work anymore.
      So my question is on how to disable the X button (hide the status bar?)?

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

        Hi,
        This works for me, you have to slide two fingers on screen to close it.

        # Hide X button
        import ui
        view = ui.View(bg_color = 'slateblue')
        view.present('sheet', hide_title_bar=True)
        
        1 Reply Last reply Reply Quote 0
        • upwart
          upwart last edited by

          That's a solution for UI. How do I do that in Scene?

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

            iirc for scene you need to use a SceneView and use this approach.

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

              Maybe stupid, but how do I do that?

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

                Hide_title_bar does not work for me. Not sure why people recommend it.

                This is a solution I came up with.

                class MyScene(scene.Scene):
                    def setup(self):
                        self.label = scene.LabelNode('Test hide title bar', 
                        position=self.size/2, parent=self)
                        self.hide_close()
                
                    def hide_close(self, state=True):
                        from obj_util import ObjCInstance
                        v = ObjCInstance(self.view)
                        # Find close button.  I'm sure this is the worst way to do it
                        for x in v.subviews():
                            if str(x.description()).find('UIButton) >= 0:
                                x.setHidden(state)
                
                scene.run(MyScene())
                
                1 Reply Last reply Reply Quote 0
                • technoway
                  technoway last edited by technoway

                  This worked for me using Pythonista 3, where v is an instance of a class derived from ui.View.

                  v.present(title_bar_color='#000000',
                            hide_close_button=True,
                            orientations=['portrait'])
                  

                  Obviously, you only need the "hide_close_button=True" part.

                  By the way, I'm relatively new here, and I still don't know how to post code so the formatting remains intact. I just searched for how to do that for 5 minutes and was unsuccessful. If anyone replies how to do that, I'll fix this post.

                  Update: Thanks dgelessus.

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

                    @technoway You can put three backticks before and after the code, like so:

                    ```
                    your code here
                    ```

                    becomes

                    your code here
                    

                    You can also add python right after the first three backticks to get Python syntax highlighting.

                    mikael 1 Reply Last reply Reply Quote 1
                    • omz
                      omz last edited by

                      @dgelessus @technoway Or just use the </> button in the editor. Adding python should usually not be necessary, syntax highlighting will mostly work without it.

                      1 Reply Last reply Reply Quote 1
                      • mikael
                        mikael @dgelessus last edited by

                        Indented by 4 spaces also works for code blocks.

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

                          @technoway, I use a simple trick @ccc mentioned a long time ago. In 'Settings->Keyboards->Text Replacement' use 3 x comas to output 3 x ticks `
                          Not often you type 3 comas in a normal workflow.

                          1 Reply Last reply Reply Quote 4
                          • omz
                            omz last edited by

                            @Phuket2 That's a great idea!

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Powered by NodeBB Forums | Contributors