Fedora Linux Support Community & Resources Center
Old 18th March 2007, 08:25 PM
rdwinders Offline
Registered User
Join Date: Dec 2006
Posts: 38
perl/tk entry widget doesn't get keyboard input

Any perl/tk folks out there that can give me a clue why the 'entry' widget in my program can't recieve input from the keyboard? I've tried visiting some tut sights and copied and pasted some sample programs and got the same result as the one I started out with. It's a simple text to file program I got out of an O'Reilly book, 'Learning Perl/Tk.' It features one entry textbox, 3 buttons, and 1 textarea. The text area gets the keyboard input fine; the text entry can have a string put in it through a hard coded variable and can read the string, but no matter what I do, the entry widget is dead to the keyboard. Cursor blinks once I have clicked on the text box or if given focus by the program but the keyboard is dead.
I'm using perl5.8.8. on a FC6 box.

Here's the main body of widget code:
use Tk;
$mw = MainWindow -> new;


$frame = $mw -> Frame -> pack(-side => 'top', -fill => 'x');
$frame -> Label (-text => "Filename: ") -> pack(-side => 'left', -anchor => 'w');

$entry = $frame -> Entry (-width => 40, -state => 'normal', -textvariable => \$filename, -takefocus => '1') -> pack(-side => 'left', -anchor => 'w', -fill => 'x', -expand => '1');
$entry -> insert('end', "");
$entry -> focus;
$filename = $entry -> get;
$frame -> Button (-text => "Exit", -command => sub { exit; } ) -> pack (-side => 'right');
$frame -> Button (-text => "Save", -command => \&save_file ) -> pack (-side => 'right', -anchor => 'e');
$frame -> Button (-text => "Load", -command => \&load_file ) -> pack (-side => 'right', -anchor => 'e');
$mw -> Label (-textvariable => \$info, -relief => 'ridge') -> pack (-side => 'bottom', -fill => 'x');
$t = $mw -> Scrolled("Text") -> pack(-side => 'bottom', -fill => 'both', -expand => 1);
Reply With Quote
Old 18th March 2007, 10:07 PM
daverj Offline
Registered User
Join Date: Jan 2006
Location: Denver, CO USA
Posts: 670
I tested the exact code you provided and had no problem running it. Not sure how to help you. Sorry

Reply With Quote
Old 18th March 2007, 10:12 PM
paul matthijsse Offline
Registered User
Join Date: Sep 2005
Location: Dieulefit, France
Posts: 721
does pressing NumLock helps?
Reply With Quote
Old 18th March 2007, 11:05 PM
rdwinders Offline
Registered User
Join Date: Dec 2006
Posts: 38
No. It didn't help. Thanks daverj for trying it on yours. So, permissions? chmod? I'm not running it in root. But, since the scrolling text receives input, I'm at a loss why the entry text box won't. The only difference I can see is that one is inside a frame.
Reply With Quote
Old 19th March 2007, 06:57 AM
RupertPupkin's Avatar
RupertPupkin Offline
Registered User
Join Date: Nov 2006
Location: Detroit
Posts: 6,637
I'd try getting rid of the "$filename = $entry -> get;" line. You already made $filename hold the value of $entry when you created $entry.
Reply With Quote
Old 19th March 2007, 11:06 PM
rdwinders Offline
Registered User
Join Date: Dec 2006
Posts: 38
This afternoon I'll try that. I think it was something I added in the different attempts to get the widget to recieve from the keyboard. I also tried to configure the GUI without the parent frame. I have also copied code from perlmonks site and tried that but always this entry widget doesn't get input from the keyboard. Right now I am wondering if it is something with the keyboard driver or a selinux setting.
Reply With Quote

entry, input, keyboard, perl or tk, widget

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Lost keyboard input in Wine nico80 Hardware & Laptops 27 25th March 2009 05:54 PM
looking for a perl or Tk widget for easily displaying text data as a table marko Programming & Packaging 2 30th September 2008 03:20 PM
Runaway keyboard input deadkenny Using Fedora 3 17th October 2007 11:10 PM
delayed response in input with keyboard thereelmike Using Fedora 1 26th February 2005 05:57 PM
Keyboard/input problems stanley90 Using Fedora 0 30th May 2004 05:02 PM

Current GMT-time: 00:36 (Monday, 25-09-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat