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.


    Reverse geo code in a scene script

    Pythonista
    location geocode scene
    2
    6
    1331
    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.
    • nerdtronn
      nerdtronn last edited by nerdtronn

      In the below script, the #1 output works as expected. The #2 output, though, called from within the scene object, does not. For #2, the location comes back correctly but the reverse geocode call always returns None. The reverse geocode doesn’t seem to work when called from scene code. Any idea how to get this to work?

      from scene import *
      import location
      
      class MyScene (Scene):
        def setup(self):
          loc2 = location.get_location()
          addr2 = location.reverse_geocode(loc2)
          print('#2')
          print(loc2)
          print(addr2)
          
      
      if __name__ == '__main__':
        loc1 = location.get_location()
        addr1 = location.reverse_geocode(loc1)
        print('#1')
        print(loc1)
        print(addr1)
        run(MyScene(), show_fps=False)
      1 Reply Last reply Reply Quote 0
      • nerdtronn
        nerdtronn last edited by nerdtronn

        Having trouble editing the post on mobile, but note there is the below line before getting loc1. Missed that when posting.

        location.start_updates()
        
        1 Reply Last reply Reply Quote 0
        • nerdtronn
          nerdtronn last edited by

          Found the below thread with the solution. Just need to add @ui.in_background above the scene method definition!

          https://forum.omz-software.com/topic/604/unable-to-use-location-reverse_geocode-inside-a-scene-layer/17

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

            The #2 Print Statement in the scene only shows a single line of text at the bottom of the scene window in my iPhone.

            The console Output shows both #1 and #2.

            Is it possible to simply print text into a scene with coordinates so I don’t need a labelnode?

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

              When you exit the script and swipe over to the console you’ll see the full output.

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

                @nerdtron Thanks, I know the console displays the whole text.

                I was just wondering if there is an easy way to place print commands with coordinates into a scene wirhout having to use labelnodes.

                The old 8 Bit Basic dialects had this, and for Python being a mental descendant of this programming Culture I wish there was the same easy approach.

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