File: hello_tk.pl

package info (click to toggle)
libpar-perl 0.952-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,068 kB
  • ctags: 512
  • sloc: perl: 14,520; ansic: 870; makefile: 57
file content (71 lines) | stat: -rw-r--r-- 2,152 bytes parent folder | download | duplicates (5)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/perl -w
########################################################################
# Copyright 2004 by Malcolm Nooning
# This program does not impose any
# licensing restrictions on files generated by their execution, in
# accordance with the 8th article of the Artistic License:
#
#    "Aggregation of this Package with a commercial distribution is
#    always permitted provided that the use of this Package is embedded;
#    that is, when no overt attempt is made to make this Package's
#    interfaces visible to the end user of the commercial distribution.
#    Such use shall not be construed as a distribution of this Package."
#
# Therefore, you are absolutely free to place any license on the resulting
# executable(s), as long as the packed 3rd-party libraries are also available
# under the Artistic License.
#
# This program is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
# See L<http://www.perl.com/perl/misc/Artistic.html>
#
#
#
########################################################################
our $VERSION = 0.02;

use POSIX qw (EXIT_SUCCESS EXIT_FAILURE);

use Tk;


#########################################################################
sub okay_response {
  my ($we_top) = @_;

  $we_top->destroy;
}

#########################################################################
sub say_hello {
  my $message = "hello";
  #.............................................
  my $okay_button;

  my $we_top = new MainWindow;
  $we_top->title("Hello");

  $we_top->Label
       (
          -text => $message . "\n",
          -justify => 'left',
       )->pack();

  #.....................................................................
  $okay_button = 
      $we_top->Button(  -text => 'Okay', 
                        -command => [  \&okay_response, 
                                       $we_top,
                                    ]
                      )->pack;
  #.....................................................................


  #########
  MainLoop;
  #########

}
#########################################################################
say_hello;