Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Tk bind question

by integral (Hermit)
on Feb 22, 2003 at 07:48 UTC ( #237699=note: print w/ replies, xml ) Need Help??


in reply to Tk bind question

The problem is caused by the fact that you are binding <Key-Escape> to sub { exit }. If you lookup exit in perlfunc, you find it performs the syscall to shutdown your whole program. What you need instead is to have a closure on $x which call's the relevant function to destroy the MainWindow.

for (@ARGV) { my $x = MainWindow->new; $x->bind("<Key-Escape>", sub { $x->destroy }); }

--
integral, resident of freenode's #perl


Comment on Re: Tk bind question
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2015-07-02 04:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (27 votes), past polls