File: hello_tk.pl

package info (click to toggle)
libpar-packer-perl 1.064-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,388 kB
  • sloc: perl: 12,774; ansic: 1,474; makefile: 30; sh: 5
file content (70 lines) | stat: -rw-r--r-- 2,115 bytes parent folder | download | duplicates (6)
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
#!/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 F<LICENSE>.
#
#
########################################################################
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;