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.


    Can I use the line() function in a layer?

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

      Is there any way to use the line() function in a layer? I want to be able draw lines on top of part of the screen, but not have to redraw everything underneath it. But I can't see how to constrain line() to one layer. Any suggestions?

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

        You could use PIL to draw an image and then create a Pythonista scene.Layer which is right-sized to display that image. The layer will now know how to redraw itself without any special code in your scene.Scene.draw() method. See diagonal_line.py at https://gist.github.com/cclauss/8683457

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

          Clever! Many thanks for the great suggestion and sample code.

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