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.


    Label corner radius not doing anything

    Pythonista
    4
    6
    2378
    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

      I change a button's corner radius just fine. Why won't a label's corner radius change? Do I have to do something special with the border or frame first?

      lbl = ui.Label()
      lbl.frame = (20,20,100,100)
      lbl.corner_radius = (5)
      
      1 Reply Last reply Reply Quote 0
      • brumm
        brumm last edited by

        You also need

        lbl.border_width = 1
        
        1 Reply Last reply Reply Quote 0
        • donnieh
          donnieh last edited by

          Thank you, this helped. The results were not as expected though (my fault). A border with a radius was indeed created; however, the sharp white label corners were still present as well. Hmmm

          My solution was to use a text view and that worked better.

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

            Looks like a bug to me.

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

              Here is what I mean:
              alt text

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

                The reason is basically that labels don't clip their content by default (I think this has changed in iOS 8 due to improved support for some Asian languages), and there's currently no way to change that (well, in the 1.6 you could technically do it via ctypes, but it requires quite a lot of code...) The easiest workaround would be to embed a label in a ui.View (i.e. make it a subview of a view that clips).

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