gtk

How can I link a set of toggle buttons like radio buttons?

吃可爱长大的小学妹 提交于 2020-07-05 10:53:12
问题 I am using Python 3 with gobject introspection for Gtk. How can I have more than one toggle button linked together so they behave similar to tabs or radiobuttons - e.g. one is selected by default, and when another is clicked the previously active one is de-selected. I have tried using set_sensetive , but that greys out the widget that it is applied on. 回答1: Use set_active() (or props.active ). Alternatively, you can create some Gtk.RadioButton widgets and set draw_indicator property to False

gtk3 - persisting shortcuts while using GSimpleAction

浪子不回头ぞ 提交于 2020-06-29 03:19:19
问题 In gtk3 there is the possibility to persist accelerator keys and pathes to file by using gtk_accel_map. The user is able to customize shortcuts by editing the related file. Now I am about to replace the deprected GtkAction interface by making use of GSimpleAction. So how can I get the required parametrs for gtk_accel_map_add_entry out of a GSimpleAction (or out of a GActionMap?), so that I can persist it ? I defined the GSimpleAction like that: void callback ( GSimpleAction *action, GVariant

gtk3 - persisting shortcuts while using GSimpleAction

余生颓废 提交于 2020-06-29 03:19:09
问题 In gtk3 there is the possibility to persist accelerator keys and pathes to file by using gtk_accel_map. The user is able to customize shortcuts by editing the related file. Now I am about to replace the deprected GtkAction interface by making use of GSimpleAction. So how can I get the required parametrs for gtk_accel_map_add_entry out of a GSimpleAction (or out of a GActionMap?), so that I can persist it ? I defined the GSimpleAction like that: void callback ( GSimpleAction *action, GVariant

Ubuntu - Anaconda 2020.02 - Namespace Gtk not available

孤人 提交于 2020-06-28 05:22:15
问题 This is on Ubuntu 16.04 LTS. I've run into the same issue as this question: ValueError: Namespace Gtk not available I've done the following to set things up for gtk3 conda install -c conda-forge pygobject sudo apt-get install libgtk-3-dev sudo apt install python3-gi gobject-introspection gir1.2-gtk-3.0 However, the simple test program at: https://python-gtk-3-tutorial.readthedocs.io/en/latest/introduction.html fails, with the same error: Python 3.7.7 (default, Mar 26 2020, 15:48:22) [GCC 7.3

Row Background Color GtkTreeView Widget

血红的双手。 提交于 2020-06-27 16:54:14
问题 I'm attempting to color disabled rows in a gtk tree view widget a light gray color. From what I've read, I'm supposed to set the background-gdk property of the corresponding cellrenderer and bind it to a model column. This sort of works. Gtk::CellRendererText* textRenderer = manage(new Gtk::CellRendererText()); textRenderer->property_editable() = false; Gtk::TreeViewColumn *col = manage(new Gtk::TreeViewColumn("Column1", *textRenderer)); col->add_attribute(*textRenderer, "background-gdk", m

When are GTK signals emitted

天大地大妈咪最大 提交于 2020-06-25 06:22:07
问题 Given a signal connected from the user to a callback function, the gtk_main thread sleeps until the signal is emitted. I searched for details on how or when it is emitted, but couldn't find any info that I don't know. More specifically is it emitted asynchronously so that I can invoke the signal in the middle of some function or it waits for the particular function to return first? Emitting the "switch-page" signal (for example with gtk_notebook_remove_page() ) from within GThread may have

When are GTK signals emitted

|▌冷眼眸甩不掉的悲伤 提交于 2020-06-25 06:20:18
问题 Given a signal connected from the user to a callback function, the gtk_main thread sleeps until the signal is emitted. I searched for details on how or when it is emitted, but couldn't find any info that I don't know. More specifically is it emitted asynchronously so that I can invoke the signal in the middle of some function or it waits for the particular function to return first? Emitting the "switch-page" signal (for example with gtk_notebook_remove_page() ) from within GThread may have

Why does the subfunction not destroy the GtkWindow?

|▌冷眼眸甩不掉的悲伤 提交于 2020-06-23 14:14:28
问题 This is my code: void window_first(); void enter_window2(GtkWidget* w, gpointer data); void quit(GtkWidget* w, gpointer data); void quit(); int main(int argc, char* argv[]) { GtkWidget* window2; gtk_init(&argc, &argv); window_first(); window2 = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_widget_show_all(window2); g_signal_connect(G_OBJECT(window2), "destroy", G_CALLBACK(gtk_main_quit), NULL); gtk_main(); return 0; } void quit(GtkWidget* w, gpointer data) { exit(1); } void enter_window2(GtkWidget

How to prevent GtkWindow growing?

隐身守侯 提交于 2020-06-17 02:53:05
问题 This is my codes: #include<gtk/gtk.h> int main(int argc,char**argv) { GtkWidget* window, *button, *grid; gtk_init(&argc,&argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(window),100,100); g_signal_connect(G_OBJECT(window),"destroy",G_CALLBACK(gtk_main_quit),NULL); //gtk_container_set_border_width(GTK_CONTAINER(window),10); gtk_window_set_resizable(GTK_WINDOW(window), FALSE); grid = gtk_grid_new(); button = gtk_button_new_with_label("1"); gtk_grid

cannot open source file “glibconfig.h” (dependency of “gtk/gtk.h”) in Studio Code

做~自己de王妃 提交于 2020-06-01 05:11:12
问题 I've configured the task json in Visual Studio Code { "tasks": [ { "type": "shell", "label": "gcc build active file", "command": "/usr/lib64/ccache/gcc", "args": [ "-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}", "`pkg-config", "--cflags", "--libs","gtk+-3.0`" ], "options": { "cwd": "/usr/lib64/ccache" }, "problemMatcher": [], "group": { "kind": "build", "isDefault": true } } ], "version": "2.0.0" } And I think the terminal output is ok,it builds without issues: > Executing