Tkinter Question

Burke, Jason JBurke at lrs.com
Thu Oct 14 15:41:19 EDT 1999


Greetings all,

I've been pouring over the tutorials for using Tkinter, but I
can't seem to find an answer to what I think should be a
simple question. 

My main problem with using Tkinter so far has been that 
I have no idea how to get data out of the GUI object. I've
used PerlTk quite a bit, and with that if I want to get info
out of a text field I would do something like this:

#!/usr/bin/perl

use Tk;

$window = MainWindow->new;
$window->Entry(-textvariable => \$your_name, width => 40)
             ->pack();
$window->Button(-text => "Get Name", -command => \&action)
            ->pack();

sub action
 {
   print "Your name is $your_name!";
 }

Or I could use the cget function (I think that's its name) to 
get the data if I had assigned a handle to the GUI object. 

In any event, if some kind soul out there could give me a 
quick example, or reference to where I can find the answer
to this I would really appreciate it (please include checkboxes,
radio buttons, entry, and text widgets if you don't mind).

Thanks in advance,

Jason Burke




More information about the Python-list mailing list