#!/usr/bin/perl use warnings; use strict; use Tk; use Finance::YahooQuote; # mouse left click to quit my @check = qw(BA BNI BASFY.PK); # stocks to check # order of information sent by yahoo my @h = ("Symbol","Name","Last","Trade Date","Trade Time","Change","% +Change", "Volume","Avg. Daily Volume","Bid","Ask","Prev. Close","Open", "Day's Range","52-Week Range","EPS","P/E Ratio","Div. Pay Date", "Div/Share","Div. Yield","Mkt. Cap","Exchange"); my %stocks; my $mw = new MainWindow; $mw->geometry('-0-0'); # lower right corner, my toolbar is at the top + :-) $mw->overrideredirect(1); # show on all desktops foreach my $stock (@check){ $stocks{$stock}{'info'}= ' '; $stocks{$stock}{'lab'} = $mw->Label(-textvariable=>\$stocks{$stock}{ +'info'}, #-width => 45, -justify => 'left', -anchor => 'nw', -height=>1, -padx=>0, -pady=>0, -bg=>'black', -fg=>'yellow')->pack(-expand=>1,-fill=>'x',-pady=> +0,-padx=>0); } #set update time... don't overload server my $id = Tk::After->new($mw,30000,'repeat',\&refresh); #30 seconds refresh(); $mw->bind('<ButtonPress-1>', sub{ Tk::exit }); MainLoop; sub refresh{ my @q = getquote(@check); foreach $a (@q) { $stocks{$$a[0]}{'info'} = $$a[2].' '.$$a[0].' '.$$a[5]."\n"; } }
In reply to Cheap Stock watch with Tk by zentara
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |