Python GTK: interactive image scrollable grid

I am writing a python program (gui in gtk) (linux btw.) I want to have a (scrollable) grid of images that can be clicked like buttons.

I plan to have 3 images in a row, show 2 rows, and then scroll vertically through the rest.

I don’t know which elements to use, Gtk.Grid, Gtk.table or something else? Should I use an image and make it clickable or use Gtk.Button and make it look like an image?

Would thank for any help :)

+4
source share
1 answer

I think you're on the right track. The widgets that I will use are as follows:

Gtk.ScrolledWindow Gtk.Grid Gtk.Button Gtk.Button ... Gtk.Button 

I do not know the advantages of using Gtk.Grid over Gtk.Table , but now I see the default widget in the meadow, so I will stick to the default settings.

Regarding the use of Gtk.Image or Gtk.Button , he documented how to display an image in a button, but I would say that it is not so easy to make an image clickable, because this event is not supported out of the box on image widgets. Therefore, the most reliable approach, in my opinion, is to use buttons.

+3
source

Source: https://habr.com/ru/post/1392365/


All Articles