• Publicidad

ASCII Art 0.2 (Version TK)

¿Estás desarrollando un proyecto, o piensas hacerlo? Pon aquí tu propuesta, lo más seguro es que alguien esté interesado en ayudarte.

ASCII Art 0.2 (Version TK)

Notapor BigBear » 2012-10-04 17:28 @770

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

Una imagen

Imagen

El codigo

Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
  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.  
Coloreado en 0.004 segundos, usando GeSHi 1.0.8.4
BigBear
Perlero frecuente
Perlero frecuente
 
Mensajes: 981
Registrado: 2009-03-01 18:39 @818

Publicidad

Volver a Proyectos

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 1 invitado

cron