[vtkusers] How to get blinkining effect in tcl/tk

John Hunter jdhunter at ace.bsd.uchicago.edu
Mon Apr 5 09:38:15 EDT 2004


>>>>> "rudreswar" == rudreswar  <rudreswar at indiatimes.com> writes:

    rudreswar>  hi all, I have a problem in tcl/tk.  My requirement is
    rudreswar> to get the blinking effect. i.e., There will be a
    rudreswar> circle which simulates an LED(light emitting diode),
    rudreswar> this circle should be continuously repainted with 500
    rudreswar> milliseconds of delay time to that i will get the
    rudreswar> blinking effect of an LED. If any body have answer
    rudreswar> please help in finding solution for the problem


Once you have created your actor, you need to define a function that
you hook into ytcl/tk timer event generator.  I don't use tcl/tk, so I
can't help you there, but here is a pygtk snippet

def toggle_visible(*args):

    if toggle_visible.on:
        actorCyl.VisibilityOn()
    else:
        actorCyl.VisibilityOff()
    toggle_visible.on = not toggle_visible.on
    renwin.Render()
    return gtk.TRUE
toggle_visible.on = True

gtk.timeout_add(500, toggle_visible)


toggle_visible will be called every 500 milliseconds, and the actors
visibility state is toggled.  If you want a smoother transition from
on <-> off, you could smoothly change the actor's opacity.

JDH



More information about the vtkusers mailing list