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.


    Passing Data to a View

    Pythonista
    3
    3
    1118
    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.
    • Dog2puppy
      Dog2puppy last edited by

      I'm displaying a view by navigating to it with a NavigationController. This view will be dynamic and will display a players stats using data retrieved from a Web API. How can I pass this data to the view?

      mikael 1 Reply Last reply Reply Quote 0
      • mikael
        mikael @Dog2puppy last edited by

        @Dog2puppy, create a custom view and load the data when you initialize it:

        class MyView(ui.View):
            def __init__(self, **kwargs):
                super().__init__(**kwargs)
                # load data from API
                # set up subviews based on the loaded data
        

        If you want to set up the view and have it be responsive while you load the data, do the loading in a method decorated with ui.in_background.

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

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors