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.


    ui.measure_string always giving (0.0, 0.0)

    Pythonista
    4
    5
    3465
    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.
    • JadedTuna
      JadedTuna last edited by

      Any ideas why?
      My code is:

      import ui
      
      print ui.measure_string("Doesn't work")
      
      1 Reply Last reply Reply Quote 0
      • brumm
        brumm last edited by

        'Return the dimensions (width, height) of a string if it was drawn with draw_string().'
        If you like take my example and put your line into the draw method. (73.70399475097656, 14.315999984741211)

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

          Sorry, this is a bug, ui.measure_string currently only works when called on the main thread, in a drawing context (e.g. when overriding a View's draw method).

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

            @omz, now I understand. Waiting for the new Pythonista with fixes :D

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

              +1 for fixing this bug

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