in reply to Predefining a word in a TK Entry/Text box?

Tk can be a bit tricky and confusing when you first start messing with it, but of course, you can add text to Text and Entry widgets. Please note that you're talking about two different sorts of widgets. Example:

# If you're using the Text widget my $txtUser = $profileOpt->Text()->pack; $txtUser->insert("end", "cheese"); # If you're using the Entry widget my $txtUser = $profileOpt->Entry()->pack; $txtUser->configure(-text=>"cheese"); # Or my $txtUser = $profileOpt->Entry(-text=>"cheese")->pack;

That should do the trick, but please, next time provide us with a little more information, like what error message do you actually get? What have you tried so far? Etc.

HTH

--
b10m

All code is usually tested, but rarely trusted.

Replies are listed 'Best First'.
Re: Re: Predefining a word in a TK Entry/Text box?
by mawe (Hermit) on Mar 07, 2004 at 14:27 UTC
    In an Entry you can also use -textvariable:
    my $var = "cheese"; ... my $txtUser = $profileOpt->Entry(-textvariable=>\$var)->pack;