elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Rompecabezas de Bitcoin, Medio millón USD en premios


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  [Perl Tk] ASCII Art 0.2
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Perl Tk] ASCII Art 0.2  (Leído 1,706 veces)
BigBear


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl Tk] ASCII Art 0.2
« en: 5 Octubre 2012, 00:30 am »

Version Tk de esta nueva version de este script para hacer ascii art desde una palabra.

Una imagen


El codigo

Código
  1. #!usr/bin/perl
  2. #ASCII Art 0.2
  3. #Version Tk
  4. #Coded By Doddy H
  5. #
  6. #http://search.cpan.org/~lory/Text-Banner-1.00/Banner.pm
  7. #
  8.  
  9. use Tk;
  10. use Tk::Dialog;
  11. use Text::Banner;
  12.  
  13. #if ( $^O eq 'MSWin32' ) {
  14. #use Win32::Console;
  15. #Win32::Console::Free();
  16. #}
  17.  
  18. my $color_fondo = "black";
  19. my $color_texto = "green";
  20.  
  21. my $ven =
  22.  MainWindow->new( -background => $color_fondo, -foreground => $color_texto );
  23. $ven->title("ASCII Art 0.2 || Written By Doddy H");
  24. $ven->geometry("555x305+20+20");
  25. $ven->resizable( 0, 0 );
  26.  
  27. my $start = Text::Banner->new;
  28.  
  29. $menula = $ven->Frame(
  30.    -relief     => "sunken",
  31.    -bd         => 1,
  32.    -background => $color_fondo,
  33.    -foreground => $color_texto
  34. );
  35. my $menulnowaxm = $menula->Menubutton(
  36.    -text             => "Options",
  37.    -underline        => 1,
  38.    -background       => $color_fondo,
  39.    -foreground       => $color_texto,
  40.    -activebackground => $color_texto
  41. )->pack( -side => "left" );
  42. my $aboutnowaxm = $menula->Menubutton(
  43.    -text             => "About",
  44.    -underline        => 1,
  45.    -background       => $color_fondo,
  46.    -foreground       => $color_texto,
  47.    -activebackground => $color_texto
  48. )->pack( -side => "left" );
  49. my $exitnowaxm = $menula->Menubutton(
  50.    -text             => "Exit",
  51.    -underline        => 1,
  52.    -background       => $color_fondo,
  53.    -foreground       => $color_texto,
  54.    -activebackground => $color_texto
  55. )->pack( -side => "left" );
  56. $menula->pack( -side => "top", -fill => "x" );
  57.  
  58. $menulnowaxm->command(
  59.    -label      => "Scan",
  60.    -background => $color_fondo,
  61.    -foreground => $color_texto,
  62.    -command    => \&now
  63. );
  64.  
  65. $aboutnowaxm->command(
  66.    -label      => "About",
  67.    -background => $color_fondo,
  68.    -foreground => $color_texto,
  69.    -command    => \&about
  70. );
  71.  
  72. $exitnowaxm->command(
  73.    -label      => "Exit",
  74.    -background => $color_fondo,
  75.    -foreground => $color_texto,
  76.    -command    => \&exitnow
  77. );
  78.  
  79. my $fondo = $ven->Text(
  80.    -width      => 75,
  81.    -heigh      => 15,
  82.    -background => $color_fondo,
  83.    -foreground => $color_texto
  84. )->place( -x => 12, -y => 40 );
  85. $ven->Label(
  86.    -text       => "Text : ",
  87.    -font       => "Impact1",
  88.    -background => $color_fondo,
  89.    -foreground => $color_texto
  90. )->place( -x => 20, -y => 265 );
  91. my $tengo = $ven->Entry(
  92.    -width      => 40,
  93.    -background => $color_fondo,
  94.    -foreground => $color_texto
  95. )->place( -x => 66, -y => 269 );
  96.  
  97. $ven->Label(
  98.    -text       => "Fill : ",
  99.    -font       => "Impact1",
  100.    -background => $color_fondo,
  101.    -foreground => $color_texto
  102. )->place( -x => 340, -y => 265 );
  103. my $fi = $ven->Entry(
  104.    -width      => 5,
  105.    -background => $color_fondo,
  106.    -foreground => $color_texto
  107. )->place( -x => 375, -y => 269 );
  108.  
  109. MainLoop;
  110.  
  111. sub about {
  112.    $ven->Dialog(
  113.        -title            => "About",
  114.        -buttons          => ["OK"],
  115.        -text             => "Coded By Doddy H",
  116.        -background       => $color_fondo,
  117.        -foreground       => $color_texto,
  118.        -activebackground => $color_texto
  119.    )->Show();
  120. }
  121.  
  122. sub exitnow {
  123.    exit(1);
  124. }
  125.  
  126. sub artnow {
  127.  
  128.    $start->set( $tengo->get );
  129.    $start->fill( $fi->get );
  130.  
  131.    return $start->get;
  132.  
  133. }
  134.  
  135. sub now {
  136.  
  137.    $fondo->delete( "0.1", "end" );
  138.  
  139.    my $now  = $tengo->get;
  140.    my $code = artnow($now);
  141.  
  142.    $fondo->insert( "end", $code );
  143.  
  144. }
  145.  
  146. #The End ?
  147.  


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Libros de Perl online [PERL]
Scripting
madpitbull_99 0 3,843 Último mensaje 18 Mayo 2011, 21:49 pm
por madpitbull_99
[Python] Ascii To Hex y Hex to Ascii
Scripting
Runex 0 3,109 Último mensaje 8 Abril 2012, 15:09 pm
por Runex
[Perl] ASCII Art 0.1
Scripting
BigBear 0 1,430 Último mensaje 3 Octubre 2012, 01:14 am
por BigBear
[Perl Tk] ASCII Art 0.1
Scripting
BigBear 2 2,010 Último mensaje 3 Octubre 2012, 01:44 am
por BigBear
[Perl] ASCII Art 0.2
Scripting
BigBear 0 1,513 Último mensaje 5 Octubre 2012, 00:29 am
por BigBear
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines