[Tutor] iterators
Alan Gauld
alan.gauld at yahoo.co.uk
Mon Jul 4 17:36:42 EDT 2016
On 04/07/16 21:38, Colby Christensen wrote:
> File "/home/colby/Calculator/Calculator_betaV3.py", line 110, in OnKeyPress
> elif keycode in (27):
> TypeError: argument of type 'int' is not iterable
The problem is that 'in' needs a collection to test. (27) is not a
single element tuple but just an integer with parens around it. To make
it a tuple you need to add a comma:
elif keycode in (27,):
That should do what you want.
Whether it's what you really need is another story. I didn't read the
rest of the code!
HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list