Ticket #623: mocinno.pl

File mocinno.pl, 448 bytes (added by Quevlar, 6 years ago)
Line 
1#!/usr/bin/perl -w
2use Tk;
3use strict;
4
5
6
7
8my $mw = MainWindow->new;
9
10
11my $frame2 = $mw->Frame(-label => "Frame",-borderwidth => 2, -relief => 'groove');
12$frame2->Button(-text => 'Run',-width => 15, -command => sub { hello(); })->pack;
13$frame2->pack(-ipadx => 20,-ipady => 20);
14
15#This loop makes that sub hello becomes like an event
16MainLoop;
17
18
19
20#Event of button
21sub hello {
22    system('echo "hello world"');
23
24    exit;  #Quit from aplication
25
26}
27
28