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 transfer a screen.

    Editorial
    loadview
    2
    4
    2870
    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.
    • yoyo
      yoyo last edited by ccc

      I’ve just started to try iOS app with pythonista, and I understood how to execute pyui from py file with load_view().
      I want to make an application which has multiple screen like top page and setting page, and so on.
      My current sample application has 2 buttons which transfer different pyui file by using load_view(), and each button looks work well. However, I notice when I tap exit icon on a screen, other screen remain working. I mean, each screen make new screen when button is tapped.
      I dont want to implement a new screen making but screen changing.
      Could you please how to change a pyui file?

      My sample is following.
      For example, Toppage has a button which is connected to goto_setting(), and when the button is tapped, it creates Setting page while Toppage is working.

      import ui
      def return_title(sender):
      	ui.load_view('Toppage').present('sheet')
      
      def goto_setting(sender):
      	ui.load_view('Setting').present('sheet')
      	
      v = ui.load_view()
      v.present('sheet')
      
      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by JonB

        You don't want to present both views -- since that does not close the other view. Instead, you want to have one root view (or a navigationview) then add the loaded view as a subview (or use navigationview.push_view). Then to swicth, you would remove the subview of your root, and replace with the new view

        An alternative would be to use present, followed by closing the old view, but that may be unreliable.

        Finally, if you are dong a settings page, you might want to use present() on the settings page, followed by wait_modal.

        Then, closing the settings page would use close() rather than re-presenting the first page.

        yoyo 2 Replies Last reply Reply Quote 0
        • yoyo
          yoyo @JonB last edited by

          @JonB Thank you so much for your comment. I would like to know how to use add_subview(). Do you know any sample page or source code URL?

          Warm regards,
          Yoyo

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

            @JonB I finally have done sample program which I want to do. In my recognition, all view is regarded as a component like button, slider on the main canvas. And each components should be added to main canvas with add_subview().
            Thank to your comment, I did it.

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