• offtheradar

    UnboundLocalError when accessing location.is_authorised() inside function

    When I try:

    import location
    
        def get_direction():
            if location.is_authorized():
            #do something
    

    I get an UnboundLocalError: local variable 'location' referenced before assignment.

    But the similar code works with other modules e.g:

    import time
    
        def get_time_diff():
            if time.time() > 1234:
            #do something
    

    How can I get around the UnboundLocalError? Importing the location module inside the function works, but I don't want to have to import it within each function that uses location.

    Maybe I'm missing something obvious so any suggestions are appreciated!

    posted in Pythonista read more
  • offtheradar

    Thanks @omz & @Phuket2. my_label.size_to_fit() worked to achieve the alignment I wanted.

    posted in Pythonista read more
  • offtheradar

    When creating a label with the frame attribute set, how can the vertical alignment of text be set within the height of the label? I want the text top aligned not center which appears to be the default.

    Thanks!

    posted in Pythonista read more
  • offtheradar

    Something else I can't find details on are the icons used in the widget examples.

    E.g. iow:ios7_minus_outline_32

    Is there a list of icons we can access?

    posted in Pythonista read more
  • offtheradar

    Thanks, got it. I didn't know about the help feature.

    posted in Pythonista read more
  • offtheradar

    Where do I find documentation on the appex module widget functions?

    The page below doesn't cover get_widget_view etc.

    http://omz-software.com/pythonista/docs/ios/appex.html

    Thanks!

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!