omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. AddledBadger

    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.


    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 9
    • Best 0
    • Controversial 0
    • Groups 0

    AddledBadger

    @AddledBadger

    0
    Reputation
    618
    Profile views
    9
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    AddledBadger Unfollow Follow

    Latest posts made by AddledBadger

    • RE: How to lock landscape orientation? Code view.present(orientations=("landscape",)) does not work anymore

      Superb, thanks, working now.

      posted in Pythonista
      AddledBadger
      AddledBadger
    • RE: How to lock landscape orientation? Code view.present(orientations=("landscape",)) does not work anymore

      Hi,

      I'd like to lock a view to portrait on the iPhone, and the code below doesn't work to do that, for me.

      So just to clarify:

      view.present(orientations = ['portrait'])
      

      no longer works?

      What's the preferred way to lock orientation now? Will the documentation get updated? Once the suggestion above has detected the orientation, how can you lock a Navigation Controller to the correct orientation?

      Thanks!

      import ui
      
      global FRAME_WIDTH
      global FRAME_HEIGHT
      message = 'Blah'
      
      def scrollview(message):
        sv = ui.ScrollView() 
        sv.background_color = 'blue'
        FRAME_WIDTH = ui.get_screen_size().width - 2
        FRAME_HEIGHT = ui.get_screen_size().height - 66 
        sv.frame = (1, 1, FRAME_WIDTH, FRAME_HEIGHT)     
        sv.content_size = FRAME_WIDTH, FRAME_HEIGHT + 500 
        view.add_subview(sv) 
          
        tv = ui.TextView()
        tv.background_color = 'red'
        tv.frame = (2, 2, FRAME_WIDTH - 4, FRAME_HEIGHT - 4 + 500) 
        tv.font = ('Palatino', 18)
        tv.editable = False
        tv.text = message
        sv.add_subview(tv)
      
      view = ui.View()                                     
      view.name = 'Demo'                                    
      view.background_color = 'black'                       
      view.frame=(0, 0, 400, 400)
      
      scrollview(message)
      
      view.present(orientations = ['portrait'])
      
      
      posted in Pythonista
      AddledBadger
      AddledBadger
    • set values for picker.date ?

      Hi,
      Searched the docs and forums but can’t seem to find this. Any help on how to set a ui date picker to a particular value, rather than the current time as it’s displaying in my code at the moment. For example, 8am tomorrow.
      Thanks, Terry

      posted in Pythonista
      AddledBadger
      AddledBadger
    • RE: Calling Pythonista from Drafts fails, then works?

      Hi, moved the script to the root and its been fine since, thanks for the suggestion. Thank, Terry

      posted in Pythonista
      AddledBadger
      AddledBadger
    • RE: Calling Pythonista from Drafts fails, then works?

      @JonB Thanks, I'll give that a try.

      posted in Pythonista
      AddledBadger
      AddledBadger
    • RE: Calling Pythonista from Drafts fails, then works?

      @dgelessus Hi, thanks for your reply. Yes, replaced the the text in question. In the specific case, it's just a string of integers, e.g., 1208060 . Consequently, I don't think there's any unusual characters, but thanks for the suggestion.

      posted in Pythonista
      AddledBadger
      AddledBadger
    • Calling Pythonista from Drafts fails, then works?

      Hi,

      I’m sending blood pressure data, e.g., 1208060 to a pythonista script to graph it. I send the data via a url from Drafts:

      pythonista3://bp/add-blood-pressure-data?action=run&argv=[[Draft]]

      The first time I do this, pythonista says there’s no such script. If I then undelete the draft and run the url again, it finds the script and works fine. Any ideas? Is this likely to be a Drafts issue or a Pythonista one?

      Thanks, Terry

      posted in Pythonista
      AddledBadger
      AddledBadger
    • RE: Add Arguments to method called from UI Scene buttons?

      Excellent, thanks both, I can work with those.

      posted in Pythonista
      AddledBadger
      AddledBadger
    • Add Arguments to method called from UI Scene buttons?

      Hi,

      I’m struggling to find a way to re-factor the following code to have a single method which accepts arguments when called from a Scene UI button, rather than two very similar ones. Any suggestions very welcome! Thanks.

      def show_view_A(sender):
      	v = ui.View()
      	v.background_color = ‘white’
      	v.name = ‘A’
      	global location
      	location = 1 # used in another method to grab a url
      	sender.navigation_view.push_view(v)
      	message = get_html(page_info,location_info)
      	scrollview(v,message)
      
      def show_view_B(sender):
      	v = ui.View()
      	v.background_color = ‘white’
      	v.name = ‘B’
      	global location
      	location = 2 # used in another method to grab a url
      	sender.navigation_view.push_view(v)
      	message = get_html(page_info,location_info)
      	scrollview(v,message)
      	
      root_view = ui.View()
      root_view.background_color = 'white'
      root_view.name = 'Stuff'
      
      A = ui.Button(title='A')
      B = ui.Button(title='B')
      
      A.action = show_view_A
      B.action = show_view_B
      
      root_view.add_subview(A)
      root_view.add_subview(B)
      
      posted in Pythonista
      AddledBadger
      AddledBadger