Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Disabling the keyboard inputs in Entry/Text widget

by Discipulus (Canon)
on Aug 26, 2022 at 07:55 UTC ( [id://11146440]=note: print w/replies, xml ) Need Help??


in reply to Disabling the keyboard inputs in Entry/Text widget

Hello KishKishore,

if keyboard input is not allowed why to use an Entry widget? I'd rather use a Label widget for this: pressing your buttons will simply append to the variable bound to the Label

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: Disabling the keyboard inputs in Entry/Text widget
by KishKishore (Novice) on Aug 26, 2022 at 09:01 UTC

    Hi, Thanks for the reply.

    I want to copy that text and paste it in another widget. I can't copy the text on Label. But I can copy the text on Entry/Text widget.

      Maybe something like:

      use strict; use warnings; use Tk; my $MW = tkinit; my $show_button_text = 'txt'; my $show_button = $MW->Button( -textvariable => \$show_button_text, -command => sub { print "$show_button_text \n"; }, )->pack(qw(-side top -fill x)); my %add_buttons; for my $add_text (qw(a bb xyz)) { $add_buttons{$add_text} = $MW->Button( -text => $add_text, -command => sub { $show_button_text .= " $add_text"; }, )->pack(qw(-side left -expand 1)); } MainLoop;
      Instead of printing, clicking $show_button might do the copy to the other widget. Tested under Strawberry Perl 5.8.9.5 (32-bit). (Update: Also works under Strawberry 5.30.3.1 64-bit.)


      Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11146440]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-20 04:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found