Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Newbie: Non-interactive status displays - HOWTO?

Reply
Thread Tools

Newbie: Non-interactive status displays - HOWTO?

 
 
Chris
Guest
Posts: n/a
 
      02-05-2008
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
 
Reply With Quote
 
 
 
 
Joost Diepenmaat
Guest
Posts: n/a
 
      02-05-2008
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.


 
Reply With Quote
 
 
 
 
Chris
Guest
Posts: n/a
 
      02-05-2008
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
 
Reply With Quote
 
MK
Guest
Posts: n/a
 
      02-18-2008
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can I use more than one status condition name in imaplib.status() harryos Python 0 10-13-2010 01:37 PM
Recommend a free 'Status Monitor' or 'Dashboard' to report overnight tasks status? Shug Java 13 12-15-2006 06:22 PM
Recommend a free 'Status Monitor' or 'Dashboard' to report overnight tasks status? Shug C++ 13 12-15-2006 06:22 PM
POST problem - IIS sc-win32-status:64; sc-status:400 saha ASP .Net 0 07-14-2005 07:10 AM
Classic asp date displays- changing over to aspnet date object displays Chumley Walrus ASP .Net 1 12-16-2004 09:57 PM



Advertisments