[Tutor] trouble using tkinter CheckButton

Alan Gauld alan.gauld at yahoo.co.uk
Tue Jan 16 06:35:59 EST 2018


On 16/01/18 04:37, Chris Roy-Smith wrote:

>    File "./debugString.py", line 7, in SetFin
>      SetStatus[x] = var.get(x)
> AttributeError: 'list' object has no attribute 'get'

> var=[IntVar() for x in range(8)]

Here you create a list of IntVar objects.
The list has no get() method - just as the error message says.
You need to access the individual IntVar for your widget.

I suspect you want

  SetStatus[x] = var[x].get()

-- 
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