Hi all, I'm struggling to get my list items using variables, here is what I have...
Code:
def getmyname(self):
myint = self.var.get()
users = self.getUsers()
if myint:
myname = users[myint] + '/'
else:
showwarning('No User', 'No user has been selected')
myname = ''
return myname
and it doesn't like that.
Quote:
myname = users[myint] + '/'
TypeError: list indices must be integers
|
self.var.get() just gets the variable from the radio button, if 0 then myname is the name of the first user in my list etc. self.getUsers() is a sub procedure that returns all names in list form from a text file. It's simple enough but I can't work out how to get the list to accept variables. Any ideas anyone? Thanks.
Edit: This is python coding.