Open a popup with spinbox inside from python

More
10 Feb 2022 02:59 - 10 Feb 2022 03:01 #234452 by alkabal
Hello

did you know a whay for add some spinbox in a popup open from a gladevcp panel  button like probe_screen ?

the actual popup system is created by the python code 
github.com/alkabal/PSNG_V3/blob/70d267b6.../python/base.py#L291

At the end the question is more : how to add spinbox in a gtk popup ?

best regards 
Last edit: 10 Feb 2022 03:01 by alkabal.

Please Log in or Create an account to join the conversation.

More
20 Feb 2022 19:50 - 20 Feb 2022 19:52 #235421 by Grotius
Hi,

Just look how to create a spinbox from gtk source examples.

Reference:
lazka.github.io/pgi-docs/Gtk-3.0/classes...tml#Gtk.SpinButton//

Provides a function to retrieve an integer value from a GtkSpinButton
// and creates a spin button to model percentage values.

gint
grab_int_value (GtkSpinButton *button,
gpointer user_data)
{
return gtk_spin_button_get_value_as_int (button);
}

void
create_integer_spin_button (void)
{

GtkWidget *window, *button;
GtkAdjustment *adjustment;

adjustment = gtk_adjustment_new (50.0, 0.0, 100.0, 1.0, 5.0, 0.0);

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (window), 5);

// creates the spinbutton, with no decimal places
button = gtk_spin_button_new (adjustment, 1.0, 0);
gtk_container_add (GTK_CONTAINER (window), button);


gtk_widget_show_all (window);
}
Last edit: 20 Feb 2022 19:52 by Grotius.
The following user(s) said Thank You: alkabal

Please Log in or Create an account to join the conversation.

More
20 Feb 2022 22:56 #235436 by alkabal
Thank you ! (i have already found a way, but your intervention is really appreciated !)

Please Log in or Create an account to join the conversation.

More
21 Nov 2022 15:33 - 22 Nov 2022 23:34 #257228 by LWsVissWLa
There is probably a more elegant way to do this, but the following should work: 1) In your gladevcp panel, add a button with an id of "probe_screen" 2) In your Python code, create a function that will create the popup window: def create_popup(): popup = gtk.Window(gtk.WINDOW_POPUP) # add your spinbox here popup.show() 3) Connect the "clicked" signal of the button to the function you created in step 2: self.builder.get_object("probe_screen").connect("clicked", create_popup). Also, I use the plugin from

[Link deleted by moderator]

I haven't banned you _yet_ as you appear to have given an answer that might work.
Last edit: 22 Nov 2022 23:34 by andypugh.

Please Log in or Create an account to join the conversation.

Moderators: HansU
Time to create page: 0.072 seconds
Powered by Kunena Forum