• Publicidad

Recibir texto de un Tk::Text

¿Apenas comienzas con Perl? En este foro podrás encontrar y hacer preguntas básicas de Perl con respuestas aptas a tu nivel.

Recibir texto de un Tk::Text

Notapor BigBear » 2010-07-06 09:07 @421

Hola. Tengo el siguiente código.

Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
  1. use Tk;
  2.  
  3. my $she = MainWindow->new(-background=>"black");
  4. $she->title("Dumping data with limit");
  5. $she->resizable(0,0);
  6. $she->geometry("400x400+20+20");
  7. $she->Label(-background=>"black",-foreground=>"yellow",-text=>"Your text",-font=>"Impact")->pack();
  8. my $todo = $she->Text(-foreground=>"yellow",-background=>"black",-width=> 45,-height=> 15)->pack();
  9. $she->Button(-background=>"black",-foreground=>"yellow",-activebackground=>"yellow",-text=>"Mandar",-command=>\&enviar)->pack(-fill=>"both");
  10. MainLoop;
  11.  
  12. sub enviar {
  13. $imp = $todo->get;
  14. print $imp;
  15. }
  16.  
Coloreado en 0.003 segundos, usando GeSHi 1.0.8.4


Pero no recibo nada cuando quiero que se imprima el texto de la Text. ¿Alguien me podría decir con qué método puedo hacer lo que quiero?
BigBear
Perlero frecuente
Perlero frecuente
 
Mensajes: 981
Registrado: 2009-03-01 18:39 @818

Publicidad

Re: Recibir texto de un Text

Notapor explorer » 2010-07-06 11:18 @512

Cambia la línea 13 a
Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
  1. $imp = $todo->get("1.0", "end");
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4

(sacado desde la página de TkDocs)
JF^D Perl programming & Raku programming. Grupo en Telegram: https://t.me/Perl_ES
Avatar de Usuario
explorer
Administrador
Administrador
 
Mensajes: 14480
Registrado: 2005-07-24 18:12 @800
Ubicación: Valladolid, España

Re: Recibir texto de un Text

Notapor BigBear » 2010-07-07 10:10 @465

Como siempre gracias explorer.
BigBear
Perlero frecuente
Perlero frecuente
 
Mensajes: 981
Registrado: 2009-03-01 18:39 @818


Volver a Básico

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 22 invitados

cron