Sep-12-2017, 11:29 PM
At first glance, I see two problems in the code:
1. Button creation function. By using a list of strings, you aren't actually creating buttons called 'Btn1', 'Btn2', and so on. You're making a list of buttons, and maybe not even that- I'm not sure you can redefine list items in a loop based on that list. If you want to make buttons with their own names, they need to be defined individually.
2. Variable creation. When you define your btn_press function, you're using a variable that doesn't exist yet. You can't do things out of order like that unless you do it within a class.
1. Button creation function. By using a list of strings, you aren't actually creating buttons called 'Btn1', 'Btn2', and so on. You're making a list of buttons, and maybe not even that- I'm not sure you can redefine list items in a loop based on that list. If you want to make buttons with their own names, they need to be defined individually.
2. Variable creation. When you define your btn_press function, you're using a variable that doesn't exist yet. You can't do things out of order like that unless you do it within a class.