<table cellspacing='0' cellpadding='0' border='0' ><tr><td valign='top' style='font: inherit;'>Hi,<br><br>I am drawing a semi transparent dotted rectangle on an image .What I want to do is to change the border ticks to alternate so they appear as if the ticks are moving around the rectangle.Here is the code that I wrote to draw the rectangle as such with hard coded co-ord for now :<br><br><span style="font-style: italic;">def expose_event(widget, event, surface):</span><br style="font-style: italic;"><br style="font-style: italic;"><span style="font-style: italic;"> ctx = widget.window.cairo_create()</span><br style="font-style: italic;"><span style="font-style: italic;"> ctx.set_source_surface(surface, 0,0)</span><br style="font-style: italic;"><span style="font-style: italic;"> </span><span style="font-style: italic;">ctx.paint()</span><br style="font-style: italic;"><span style="font-style:
italic;"> ctx.set_source_rgba(1, 1, 1,0.5)</span><br style="font-style: italic;"><span style="font-style: italic;"> <br> ctx.save()</span><br style="font-style: italic;"><span style="font-style: italic;"> </span><br style="font-style: italic;"><span style="font-style: italic;"> ctx.new_path()</span><br style="font-style: italic;"><span style="font-style: italic;"> ctx.translate(3*20, 0)</span><br style="font-style: italic;"><span style="font-style: italic;"> square(ctx)</span><br style="font-style: italic;"><span style="font-style: italic;"> ctx.fill()</span><br><br style="font-style: italic;"><span style="font-style: italic;"> ctx.restore()</span><br style="font-style: italic;"><br style="font-style: italic;"><span style="font-style: italic;"> </span><br style="font-style:
italic;"><span style="font-style: italic;"> ctx.set_line_width(20 / 16)</span><br style="font-style: italic;"><span style="font-style: italic;"> ctx.set_tolerance(0.1)</span><br style="font-style: italic;"><span style="font-style: italic;"> ctx.set_line_join(cairo.LINE_JOIN_MITER)</span><br style="font-style: italic;"><span style="font-style: italic;"> ctx.set_dash([20/2.0, 20/2.0], 8)</span><br><br style="font-style: italic;"><span style="font-style: italic;"> ctx.save()</span><br style="font-style: italic;"><span style="font-style: italic;"><br> ctx.new_path()</span><br style="font-style: italic;"><span style="font-style: italic;"> ctx.set_source_rgba(0,0 ,0 ,0.5)</span><br style="font-style: italic;"><span style="font-style: italic;"> ctx.translate(3*20, 0)</span><br style="font-style: italic;"><span
style="font-style: italic;"> square(ctx)</span><br style="font-style: italic;"><span style="font-style: italic;"> ctx.stroke_preserve()</span><br style="font-style: italic;"><span style="font-style: italic;"><br> ctx.restore()</span><br><br>Now I can change the ticks by changing the set_dash args but I don't want to put it in an infinite while loop.Also,I don't want it to be CPU intensive.<br><br><br>" life isn't heavy enough,it flies away and floats far above action"</td></tr></table><br>
<hr size=1>
Start at the new Yahoo!7 for a better online experience - <a href="http://au.rd.yahoo.com/mail/taglines/au/y7mail/default/*http://au.docs.yahoo.com/somethingwonderful/index.php?p1=brand&p2=other&p3=au&p4=tagline" target=_blank>Start Here</a>.