Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Process keybord input
Hello,

i have a simple Perl/Tk script which just displays an image.
Now i want to call a function if the user hits for example the "Left" Key.

How can i do this?
In which books / online-resources can i look up such things for myself,
so that i don't have to borther you with such "basic" questions anymore?

Thanks a lot,
Timo

Report this thread to moderator Post Follow-up to this message
Old Post
Timo Schneider
11-09-04 01:58 AM


Re: Process keybord input
Timo Schneider <timo.schneider@s2004.tu-chemnitz.de> wrote in
news:cmou4t$uli$1@anderson.hrz.tu-chemnitz.de:

> i have a simple Perl/Tk script which just displays an image.
> Now i want to call a function if the user hits for example the "Left"
> Key.
>
> How can i do this?

That's done by "binding" an event (in this case, a key going down) to one
or more widgets.

> In which books / online-resources can i look up such things for
> myself, so that i don't have to borther you with such "basic"
> questions anymore?

The documentation that comes with Perl/Tk is pretty comprehensive (in your
case, you'll want to start with the docs for Tk::Bind) but it can sometimes
be hard to figure out where to start (it helps if you have the
documentation in a hyperlinked form, as there's *lots* of cross-referencing
in the Tk documentation; I use Sean Burke's wonderful little
Pod::Webserver, which sets up a local webserver that serves up all the Perl
documentation on my system).

For a more tutorial approach, O'Reilly's _Mastering Perl/Tk_ is recommended
by lots of regulars.

Report this thread to moderator Post Follow-up to this message
Old Post
Eric Bohlman
11-09-04 08:55 AM


Re: Process keybord input
In article <cmou4t$uli$1@anderson.hrz.tu-chemnitz.de>, timo.schneider@s2004.
tu-
chemnitz.de says...
> Hello,
>
> i have a simple Perl/Tk script which just displays an image.
> Now i want to call a function if the user hits for example the "Left" Key.
>
> How can i do this?
> In which books / online-resources can i look up such things for myself,
> so that i don't have to borther you with such "basic" questions anymore?

The book you must have as you are learning perl/Tk, and even after
you are comfortable working with it, is MASTERING PERL/TK by Steve
Lidie and Nancy Walsh, the former being a contributor to this newsgroup.

In it you will learn of the bind method which associates callbacks
with events, a keystroke being one example of an event.

--
Go to http://MarcDashevsky.com to send me e-mail.

Report this thread to moderator Post Follow-up to this message
Old Post
Marc Dashevsky
11-09-04 08:55 AM


Re: Process keybord input
"Timo Schneider" <timo.schneider@s2004.tu-chemnitz.de> wrote in message
news:cmou4t$uli$1@anderson.hrz.tu-chemnitz.de...
> Hello,
>
> i have a simple Perl/Tk script which just displays an image.
> Now i want to call a function if the user hits for example the "Left" Key.
>
> How can i do this?
> In which books / online-resources can i look up such things for myself,
> so that i don't have to borther you with such "basic" questions anymore?
>
> Thanks a lot,
> Timo

$main_window -> bind ('<KeyRelease-A>' => \&subroutine_name);



Report this thread to moderator Post Follow-up to this message
Old Post
Richard S Beckett
11-09-04 01:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PerlTk archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:44 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.