There is: a list of image names for applying them to the buttons ( image_list ), the variables image_list = "../Images" and image_int = len (os.listdir (image_dir)) .

After the loop for x in range (imagelist) starts :

In the body of the cycle:

Y = 0 Y+= 10 #ImageLink = PhotoImage(file="../Images/img%i"% i +".gif") FrameButton = Button(root,text=images_names[i], width=10,height=1, relief=GROOVE).grid(row=0,column=Y) 

The problem is that in the top left corner there is only the last button from the list, and not a column (top to bottom).

And the second question is how each generated button is assigned a link to different images, given that the image name is also generated in a loop ( "img% i"% i.gif " ).

  • "buttons are not placed from the top-left edge" - what? "assign a link to different images" - why? - abalckin 2:21 pm
  • If you mean the function on the button, then use command = lambda par = par: call_function (par) - Xyanight
  • Do you really want to give everyone the same button name? Maybe instead of FrameButton = ... write FrameButtons.append (..), first making it a list? Give a large piece of code so that you can only fix, and not write again. Um ... two years ago. - Boris Vlasenko

0