bind in Tkinter

Shankar Iyer (siyer@Princeton.EDU) siyer at Princeton.EDU
Fri Jun 10 17:04:09 EDT 2005


I believe the quit function is built in.  Anyway, I get the same type of error if I substitute a function that I have defined.

Shankar

----- Original Message -----
From: VK <myname at example.invalid>
Date: Friday, June 10, 2005 4:53 pm
Subject: Re: bind in Tkinter

> Shankar Iyer (siyer at Princeton.EDU) wrote:
> > I have been trying to learn how to associate keyboard events with 
> actions taken by a Python program using Tkinter.  From what I've 
> read online, it seems that this is done with the bind methods.  In 
> one of my programs, I have included the following:
> > 
> > self.enternumber = Entry(self)
> > self.enternumber.bind("<Return>",self.quit)
> > self.enternumber.pack({"side":"top"})
> > 
> > It seems to me that, as a result of this code, if the enternumber 
> Entry widget is selected and then the <Return> key is pressed, then 
> the program should quit.  Indeed, it seems that the program does 
> attempt to quit, but instead an error message appears claiming that 
> quit() takes 1 argument but 2 are given.  I get the same type of 
> error if I replace self.quit with some function that I have 
> written.  I am not sure how to fix this problem and hope that 
> someone here can spot my error.  Thanks for your help.
> > 
> > Shankar
> > 
> > 
> Have you defined quit function?
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 




More information about the Python-list mailing list