fire-eggs / pyTagger

Utility to view / modify image metadata tags
MIT License
0 stars 0 forks source link

Thumbnails to window size and resize #2

Open fire-eggs opened 10 months ago

fire-eggs commented 10 months ago

Change thumbnails across to fit window width [not a hard-coded count].

On window resize, adjust number of thumbnails.

fire-eggs commented 10 months ago
def resize_canvas(event):

    new_width = event.width
    new_height = event.height

    # Update the canvas size
    b.config(width=new_width, height=new_height)
    b.itemconfigure(item, image=photob)  # Update the image size (optional)

root = Tk()
root.title('Érzékek kertje')
root.attributes('-fullscreen', True)

b = Canvas(root, width=1200, height=900, bg='grey', bd=2, relief=SOLID, scrollregion=(0, 0, 0, 0))
photob = PhotoImage(file='alap.gif')
item = b.create_image(590, 330, image=photob, tags='ed')
b.grid(row=1, column=1, rowspan=6, padx=0, pady=0)

# Bind the canvas to the resizing event of the main window
root.bind('<Configure>', resize_canvas)

root.mainloop()