0

I am a begginer in programmation and in english, so I can make easy mistakes. anyway In my program, I make a class instruments and I must change the picture, the song, the column, and the row. So I wrote this :

import tkinter


from playsound import playsound
fen = tkinter.Tk()
fen.geometry("600x600")

class instruments:
    def __init__(self, imge, colone, ligne, son):  
        
        self.colone = colone
        self.imge = imge
        self.son = son
        self.ligne = ligne
        
        img = tkinter.PhotoImage(file=imge)

        def play_sound(): 
            #playsound(son)
            print(son)
        tkinter.Button(fen, image=img, command=play_sound).grid(column=colone, row=ligne)


#cor

instruments(r'cor.png', 1, 1, 'plustard.mp4') 

#tuba

instruments(r'tubas.png', 2, 1, 'plustard.mp4')



fen.mainloop()

But when I run the program, there is two empty buttons. What can I change in my code? Thank you !

Bryan Oakley
  • 341,422
  • 46
  • 489
  • 636
ilou
  • 21
  • 4

0 Answers0