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.


    Button title text wrap

    Pythonista
    2
    3
    1612
    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.
    • donnieh
      donnieh last edited by

      Can a ui.button have text that wraps many lines? I can only get it to be one line...

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

        little known fact: buttons are views, and can have subviews.
        use a Label, as a subview of a button. see for example:

        # coding: utf-8
        import ui,faker
        f=faker.Faker()
        
        v=ui.View(frame=(0,0,576,576))
        b=ui.Button(frame=(100,200,200,100),bg_color='#ffede7')
        lbl=ui.Label(frame=(0,0,200,100),name='button_label')
        lbl.number_of_lines=0
        lbl.alignment=ui.ALIGN_CENTER
        
        def a(sender):
           sender['button_label'].text=f.sentence()
        
        b.action=a
        b.add_subview(lbl)
        v.add_subview(b)
        
        v.present('sheet')
        
        1 Reply Last reply Reply Quote 0
        • donnieh
          donnieh last edited by

          Ooooh. Now that's interesting....

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