UPDATE MAR 19,2008 Fixed a positioning problem for Time ( I was thrown off by system relativity :-) )

I was meditating on the fallacy of the human notion of the present moment. There is no moment.....only flow. Inspired by a song I heard last night

#!/usr/bin/perl use warnings; use strict; use Tk; my $mw=tkinit; $mw->geometry('+300+300'); $mw->fontCreate('big', -family=>'arial', -weight=>'bold', -size=>int(-18*18/14)); my $c=$mw->Canvas(-width=>600,-height=>100,-bg=>'white')->pack; #Create haiku my $t1 = $c->create('text',20,20, -anchor=>'w', -font => 'big', -text=>'my socks are new, but'); my $t3; $mw->after(2000,sub{ my $t2 = $c->create('text',20,50, -anchor=>'w', -font => 'big', -text=>'it won\'t last long, because '); my ($bx,$by,$bx1,$by1)= $c->bbox($t2); + #print "$bx1\n"; # $t3 = $c->create('text', 290 ,50, # fixed :-) $t3 = $c->create('text', $bx1 ,50, -anchor=>'w', -font => 'big', -text=>'Time'); }); my $t4; $mw->after(5000,sub{ $t4 = $c->create('text',20,80, -anchor=>'w', -font => 'big', -text=>'keeps moving along'); }); $mw->after(5500,sub{ $mw->repeat(10, sub{ $c->move($t3,1,0); $c->move($t4,1,0); })}); MainLoop;

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

Replies are listed 'Best First'.
Re: Tk Time Haiku
by Pancho (Pilgrim) on Mar 11, 2008 at 01:47 UTC
    So much better when you can actually see the poem in action. I could tell you what the issue (i.e.why the program was not working for me the first time around) but then I would have to create a new user name altogether to remain anonymous. In brief the issue was between the chair and the keyboard. But hey I learned about Tk!!!
      ...but then I would have to create a new user name altogether to remain anonymous.

      Registered users like yourself can still post as Anonymous Monk; you'd just need to be logged out.

Re: Tk Time Haiku
by Argel (Prior) on Mar 12, 2008 at 01:10 UTC
      ++

    Very amusing! Thanks and well done! :-)

Re: Tk Time Haiku
by pobocks (Chaplain) on Mar 18, 2008 at 22:15 UTC

    On my system the offset for Time is a little off. Doesn't clearly separate until x = 315. Weird system glitch, or am I missing intentional meaning?

      It's probably the way the Scalable fonts are made on your system. I cheated a bit, in the interest of simplicity, and just hard-coded the position of Time, based on my display. I thought about doing it better, by setting Time to the right of the bbox of it's preceding phrase, but I figured it wasn't worth it. Now I know better, and a fix will come by the end of the day. Thanks for reporting it. :-)

      As an aside, this reminds me of all the recent nodes on software testing. How could I have possibly tested for this, other than let hundreds of monks, all with different systems, try it.


      I'm not really a human, but I play one on earth. Cogito ergo sum a bum

        Well, hundreds of monks at hundreds of keyboards seems like a valid method. And then there's magical intuition fairies. That's two ;-)