Python Forum
Button not defined, why?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Button not defined, why?
#3
Not sure of the whole problem you have but here is a snippet from a program I wrote to create a bunch of buttons.
ro = 1
line = 1
colcount = 10
for x in range(1,56):
        txt = str(x)
        myname="button" + txt
        myname = Button(frame3, text = txt, font = 30, width = 3)
        myname.bind('<Button-1>', play_song)
        myname.grid(row = ro, column = line)
        line += 1
        if line == colcount:
            line = 1
            ro += 1
the name of the buttons will be button1, button2 etc and the text on the corresponding button will be 1,2 and so on.
Maybe that will be of use in solving part of your problem
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,186 Jun-10-2021, 01:05 AM
Last Post: Tomli
  [PySimpleGui] How to alter mouse click button of a standard submit button? skyerosebud 3 5,138 Jul-21-2019, 06:02 PM
Last Post: FullOfHelp
  [Tkinter] button not defined OldManProgrammer 2 4,587 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