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.


    Two Very Needed Questions!

    Pythonista
    2
    5
    2887
    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.
    • AtomBombed
      AtomBombed last edited by

      1: Putting a sheet UI view on top of a fullscreen UI view on iPad.
      • For some reason, I can't figure out a way to load to different UI's at the same time. I am trying to execute the sheet .py file, from the fullscreen .py file. It executes the sheet .py file, but it has an error trying to load the second .pyui file on top of the firstly loaded fullscreen .pyui file.
      • If this is confusing, I will post code, but right now I am on time constraints.

      2: Getting to manipulate attributes to a UI view like textview, without using superview[(view to manipulate here)]. That way I don't have to have a button or a switch run a function in order to manipulate another view's attributes under the same parent view.

      def btntapped(sender):
          sender.superview["textview1"].text
      

      If you could post straight up coded answers, and a little bit of explanation of what it is doing, that would be helpful. Thank you for the help!

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

        OK, I answered question one myself. It was a simple work around. But I still need an answer to two. The!

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

          A common way to handle question 2 is to store "shortcuts" in the top level class to whatever ui elements you want to easily access.

          import ui,console
          class MyView(ui.View):
          	def __init__(self,*args,**kwargs):
          		ui.View.__init__(self,*args,**kwargs)
          		self.tv	= ui.TextField(frame=(20,20,200,50))
          		self.b = ui.Button(frame=(100,100,100,100),bg_color='red',title='push')
          		self.b.action=self.btn_action
          		self.add_subview(self.b)
          		self.add_subview(self.tv)
          	def btn_action(self,sender):
          		console.hud_alert(self.tv.text)
          v=MyView()
          v.present()
          
          AtomBombed 1 Reply Last reply Reply Quote 0
          • AtomBombed
            AtomBombed @JonB last edited by

            @JonB How do I access ui elements created in the editor, not through the script? That's what I'm attempting to do. Thanks for your help Jon. You're the only one who actually answers and helps me out.

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

              The same basic approach applies, just after you load the view, make convenience variables that point to subviews you plan on referencing a lot. For instance, see polymerchm's chordcalc: after loading, he creates globals for easy referencing.
              https://github.com/polymerchm/chordcalc/blob/master/chordCalc/chordcalc.py#L1766

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