Newbie: Non-interactive status displays - HOWTO?

Discussion in 'Perl' started by Chris, Feb 5, 2008.

  1. Chris

    Chris Guest

    I'm a perl Tk newbie trying to create a pgm to display the status of
    several servers by a green/red indicator light. After going over some
    howto's & examples, I'm still stumped.

    All of the examples I can find are geared towards dealing with some user
    interaction (clicking buttons, typing text, etc.), but I'm looking for a
    non-interactive update of status lights, say when a server goes down,
    stops listening on a port, etc.

    Basically I'd like to know how to update a widget color based on results
    from a monitoring subroutine - ie how to pass info back into the Tk
    window. I tried setting a text widget to a global variable that gets
    manipulated in a routine forked prior to MainLoop, but no luck.

    Sooooo....can anybody provide guidance as how to pass values back into a
    Tk window? Examples greatly appreciated..

    Chris, Feb 5, 2008
    1. Advertisements

  2. Tk is event based. That means that you're just executing code whenever
    some event happens. The event can be a user action but it can also be
    activity on a socket or a timeout or whatever.

    You may want to look at the Tk::after manpage.

    Joost Diepenmaat, Feb 5, 2008
    1. Advertisements

  3. Chris

    Chris Guest

    Thx...I'll check that out
    Chris, Feb 5, 2008
  4. Chris

    MK Guest

    It may be easier to destroy and recreate a widget, eg. in a different
    color, than to change the color of an existing widget, and it looks
    exactly the same.
    MK, Feb 18, 2008
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.