Python Forum
Button not defined, why?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Button not defined, why?
#2
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.
Reply


Messages In This Thread
Button not defined, why? - by gb_johnny - Sep-12-2017, 07:31 AM
RE: Button not defined, why? - by Lux - Sep-12-2017, 11:29 PM
RE: Button not defined, why? - by Barrowman - Oct-23-2017, 09:40 PM
RE: Button not defined, why? - by Windspar - Nov-12-2017, 01:01 PM
RE: Button not defined, why? - by Barrowman - Nov-12-2017, 11:26 PM
RE: Button not defined, why? - by metulburr - Nov-13-2017, 12:06 AM
RE: Button not defined, why? - by Windspar - Nov-13-2017, 12:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Kivy] Acces atributes from a button defined in a class inside the .kv Tomli 2 2,150 Jun-10-2021, 01:05 AM
Last Post: Tomli
  [PySimpleGui] How to alter mouse click button of a standard submit button? skyerosebud 3 5,080 Jul-21-2019, 06:02 PM
Last Post: FullOfHelp
  [Tkinter] button not defined OldManProgrammer 2 4,548 Nov-21-2018, 07:53 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020