Home Variables for each item in a list
Reply: 0

Variables for each item in a list

user596
1#
user596 Published in May 21, 2018, 3:10 am

I have a list of variables named Weapons and I need to make radio buttons for each item in that list, in a weapon switching system. (Using Tkinter)

I tried doing something like this initially:

for item in Weapons:
     x = Radiobutton(equipped, text=item['name'], variable=player['weapon'], 
     value=item)
     x.pack()

But this failed because all the radio buttons had the same value. I don't know how many buttons will be needed because it is relative depending on the number of variables inside Weapons.

How can I do this?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.307352 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO