10 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
sub hochtag { $table->remove($hochlabel); my $hochzeit = date "2005-12-2 11:30:00"; my $date = now; my $hh=""; my $mm=""; my $TT =""; my $HH =""; my $MM =""; my $TTrest =""; my $TTrest1 =""; my $TTrest2 =""; my $ergebnis = $date - $hochzeit; my $ergebnisTT = $ergebnis / (86400); $TT = int($ergebnisTT); my $TTT = $TT; $TTrest = ($TTT / 1000 - int($TTT / 1000))*1000; $TTT = int($TTT / 1000); if ($TTT >= 1) { $TTT ="$TTT."; } if ($TTT == 0) { $TTT =""; } if ($TTrest < 100) { $TTrest1 ="0"; } if ($TTrest < 10) { $TTrest2 ="0"; } my $ergebnisHH = ((($ergebnis / (86400)) - int($ergebnisTT)) * 24); $HH = int($ergebnisHH); if ($HH<10) { $hh="0"; } my $ergebnisMM = (((($ergebnis / (86400)) - $TT) * 24) - $HH)*60; $MM = int($ergebnisMM); if ($MM<10) { $mm="0"; } my $hochtag = ("$TTT$TTrest1$TTrest2$TTrest $hh$HH:$mm$MM"); my $hochlabel2 = new Gtk2::Label(); $hochlabel->set_markup ("<span font-family=\"URW Chancery L\" color=\"#FF0000\" font_desc=\"40\">$hochtag</span>"); $table->attach_defaults($hochlabel, 0, 1, 0, 4); $hochlabel->show; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
sub hochtag { $table->remove($hochlabel); my $hochzeit = date "2005-12-2 11:30:00"; # aus perlmodul? my $date = now; # == time? my $sekunden = $date - $hochzeit; my $tage = int( $sekunden/86400 ); $sekunden -= $tage*86400; my $stunden = int( $sekunden/3600 ); $sekunden -= $stunden*3600; my $minuten = int( $sekunden/60 ); $sekunden -= $minuten*60; # Tausenderpunkte $tage=~s/(?<=\d)(?=(?:\d{3})+$)/./cg; # Ausgebe erzeugen my $hochtag = sprintf('%s %2u:%2u.%2u',$tage,$stunden,$minuten,$sekunden); $hochlabel->set_markup ("<span font-family=\"URW Chancery L\" color=\"#FF0000\" font_desc=\"40\">$hochtag</span>"); $table->attach_defaults($hochlabel, 0, 1, 0, 4); $hochlabel->show; } # einmal pro Sekunde ausführen Glib::Timeout->add (1000,\&hochtag);
Glib::Timeout->add (1000,\&hochtag);
Use of /c modifier is meaningless in s/// at hochzeit.pl line 30.
use Gtk2 '-init';
$tage=~s/(?<=\d)(?=(?:\d{3})+$)/./cg;
1 2 3 4 5 6 7 8
my $loop = Glib::MainLoop->new; my $count = 1; my $timer = Glib::Timeout->add (1000, \&gibmir, undef, 1 ); sub gibmir{ $count++; &aktuell; return 1; } my $quit = Gtk2::Button->new("Kill me softly"); $table->attach_defaults($quit, 0, 2, 9, 10); $quit->signal_connect (clicked => sub { &stop; } ); $window->show_all; $table->show; $loop->run; sub stop { $loop->quit; Gtk2->main_quit; }
Gtk-CRITICAL **: gtk_main_quit: assertion `main_loops != NULL' failed at einfach line 106.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/perl
use strict;
use warnings;
use Gtk2 '-init';
my $cnt=0;
Glib::Timeout->add (1000, \&gibmir);
my $window= Gtk2::Window->new();
my $vbox=Gtk2::VBox->new(0,0);
$window->add($vbox);
my $quit = Gtk2::Button->new("Kill me softly");
$quit->signal_connect (clicked => sub { &stop; } );
$vbox->pack_start($quit,0,0,0);
my $count = Gtk2::Label->new(' COUNT: 0 ');
$vbox->pack_start($count,0,0,0);
$window->show_all;
Gtk2->main;
sub aktuell
{
$count->set_text(" COUNT: $cnt ");
}
sub gibmir
{
$cnt++;
&aktuell;
return 1;
}
sub stop
{
Gtk2->main_quit;
exit(0);
}
10 Einträge, 1 Seite |