Advertisement
hackloper775

abreimagenperl

Nov 10th, 2012
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.09 KB | None | 0 0
  1. #!/usr/bin/env perl
  2. #===============================================================================
  3. #
  4. #         FILE: imagen.pl
  5. #
  6. #        USAGE: ./imagen.pl  
  7. #
  8. #  DESCRIPTION: Abre imágenes desde la linea de comandos
  9. #
  10. # REQUIREMENTS: Gtk3
  11. #        NOTES: No abrir imágenes de mas de 1mb
  12. #       AUTHOR:  (),
  13. #      VERSION: 1.0
  14. #      CREATED: 10/11/12 14:08:19
  15. #===============================================================================
  16.  
  17. use strict;
  18. use warnings;
  19. use feature ':5.14';
  20. use Gtk3 -init;
  21. use Glib qw/TRUE FALSE/;
  22.  
  23. if($ARGV[0]) {
  24.  
  25. my $foto = $ARGV[0];
  26. my $ventana = Gtk3::Window->new('toplevel');
  27.     $ventana->set_title("$foto");
  28.     $ventana->set_position("mouse");
  29.     $ventana->set_default_size(400, 100);
  30.     $ventana->set_border_width(5);
  31.     $ventana->signal_connect (delete_event => sub { Gtk3->main_quit });
  32.  
  33. my $imagen = Gtk3::Image->new_from_file ("$foto");
  34.  
  35. my $hbox = Gtk3::Box->new("vertical", 0);
  36.     $hbox->pack_start($imagen, FALSE, FALSE, 0);
  37.  
  38. $ventana->add($hbox);
  39.  
  40. $ventana->show_all;
  41.  
  42. Gtk3->main;
  43. } else {
  44.     print "\n[+] Sintax : $0 <imagen>\n";
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement