Design and program in Glade and Python a scrollable list of a bunch of elements

53 Views Asked by At

I'm a "new" programmer, more that 15 years ago I learned python. Now.. I completely out!

I started again to program in python (on linux), and I want to create a "simple" timer.

The main interface consist in two section, one to set the timer, and the other one, in a list of the started timer, in this case we have multiple timer started.

This "list" isn't a simple gtktree, but each item of the list, consist in a "mini window" with the time left, and some button, to stop, pause etc... (instead of creating a new window for each timer started)

I'm doing this mainly for learning (and in second time, I have a timer for my kitchen!). The timer is only an excuse. I only want to lean of create a scrollable list of "mini window".

Is this feasible in glade? How I can interact with python whit the multiple timer in the list? Can you tell me something that I can go and look for on, the internet or in some documentation?

Very thanks in advance!

I have tried to search on similar list, but I found only result about tree list or similar one. (I currently search about made this in multiple separate window, instead of a list, but I'm still in learning mode)

1

There are 1 best solutions below

1
Kripto On

Okay, first of all, Glade only works with GTK3, I recommend you start with GTK4, which has a very interesting interface creation tool called WorkBench. But let's consider what you want to do regardless of the version.

There are many ways to achieve the visual result you want, but what you want seems to be:

a Gtk.Window with a Gtk.Pained as a child. As the first child of Gtk.Pained (the one on the left), you'll have a Gtk.Box containing all the widgets you need to create your timer. For example a Gtk.Entry to put the timer time, and a Gtk.Button to save the created timer.

As the second child of Gtk.Pained (which will be on the right side) you will have a Gtk.ListBox, inside it you will have a Gtk.ListBoxRow as a child for each timer already created.

Each Gtk.ListBoxRow will have a Gtk.Box as a child, and as children of Gtk.Box you will have a Gkt.Label (to display the time, like 04:20:12), and a Gtk.Button for play/pause .

This is quite simple to do in Glade.