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..

    TIA
     
    Chris, Feb 5, 2008
    #1
    1. Advertising

  2. Chris <> writes:

    > 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.


    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.
     
    Joost Diepenmaat, Feb 5, 2008
    #2
    1. Advertising

  3. Chris

    Chris Guest

    Joost Diepenmaat wrote:
    > Chris <> writes:
    >
    >
    >>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.

    >
    >
    > 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.
    >
    >

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

    MK Guest

    On Tue, 05 Feb 2008 11:43:55 -0600, Chris wrote:

    > 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..
    >
    > TIA


    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
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. aacool
    Replies:
    4
    Views:
    390
    aacool
    Feb 17, 2004
  2. Chumley Walrus
    Replies:
    1
    Views:
    12,219
    =?Utf-8?B?QnJpYW4gQnJvd24=?=
    Dec 16, 2004
  3. WJ
    Replies:
    2
    Views:
    526
  4. Helmut Jarausch

    interactive help on string functions - howto

    Helmut Jarausch, Sep 29, 2004, in forum: Python
    Replies:
    11
    Views:
    769
    Skip Montanaro
    Sep 29, 2004
  5. James
    Replies:
    4
    Views:
    211
    James
    Jun 15, 2004
Loading...

Share This Page