I'm trying to put a set of 16 pictures into a tkinter frame. I've created a dictionary that maps the image address name (stored in imgbutton) as a key to the dictionary imagedict the value of which is a string containing its position in the tkinter grid (example a button in column 0 and row=1 would have the name backgroundpic5.jpg and the value "01").
Each row contains 4 pictures and there are 4 rows in total. The PhotoImage equivalent of imgbutton is buttonphoto (created using PIL). However, when i try running this, it tells me the grid_configure command accepts on 2 arguments while i have given 3 (Type Error)
Button= tk.Button(root, image=buttonphoto)
Traceback (most recent call last):
File "C:\Users\USER\Desktop\ComputerProject\Tester2Imagebg.py", line 44, in <module>
TypeError: grid_configure() takes at most 2 arguments (3 given)
Try doing the following.
Pos=imagedict[imgbutton] GridColumn= Pos; GridRow= Pos Button= tk.Button(root, image=buttonphoto) Button.grid(column=GridColumn, row=GridRow) Button.pack()