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.


    View.close()

    Pythonista
    4
    4
    2593
    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.
    • donnieh
      donnieh last edited by

      Is there a function or action I can refer to when a view is closed after view.present()?

      I want to call a function when closed. In my case, I close the view with the left blue X in the title bar.

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

        I was quite certain that there was a View.will_close method, but I can't find it in the docs. Maybe I'm imagining things. Other solutions could be View.wait_modal() (which blocks execution and returns once the view is no longer visible) or adding a custom close button that calls View.close() and then runs the "cleanup" code.

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

          will_close does work, but you have to make a custom View class.
          http://omz-software.com/pythonista/docs/ios/ui.html#building-custom-views

          (Edit:added reference)

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

            See close_action() and close_button() in https://github.com/671620616/PhantomChess/blob/master/Phantom/gui_pythonista/game_view.py which creates a custom close X to allow you to hide the title bar to maximize screen real estate for your content.

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