Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] Changing polygon line thickness only

edited October 2013 in OpenSesame

Is it possible, where there are multiple drawn objects on a canvas, to just change the line thickness of the polygons shown and nothing else? Items are in an inline script.

... and also now that I think about it, can you change the line style? (i.e. to a variety of dash-lines or similar...)

Thanks,

Lee

Comments

  • edited 1:06AM

    Hi Lee,

    You can change the linewidth of, for example, a polygon by calling the function set_penwidth() right before drawing the shape. For example:

    from openexp.canvas import canvas
    my_canvas = canvas(exp)
    my_canvas.set_penwidth(5)
    my_canvas.circle(100, 100, 50, fill=False)
    my_canvas.set_penwidth(30)
    my_canvas.circle(500, 500, 50, fill=False)
    my_canvas.show()
    self.sleep(2000)
    

    will draw two circles with different linewidths (i.e., 5 and 30 px, respectively).

    For more information, see:

    Does this help?

    Best,

    Lotje

  • edited October 2013

    That helps a lot... I thought the penwidth function was only canvas-wide, I didn't realise it could be used repeatedly for different objects.

    Any ideas about changing line style in a similar fashion?

    Thanks again!

    Lee

Sign In or Register to comment.