gtk3

Why do I get a segmentation fault in my GTK+ signal callback?

醉酒当歌 提交于 2020-01-09 11:27:07
问题 I am trying to measure the size of a GTK label: #include <gtk/gtk.h> static void map_event(GtkWidget *window, gpointer lab) { g_print( "In the callback..\n" ); GtkWidget *label = GTK_WIDGET(lab); g_print( "Everything is ok..\n" ); } static void activate (GtkApplication* app, gpointer user_data) { GtkWidget *window = gtk_application_window_new (app); gtk_window_set_title (GTK_WINDOW (window), "Window1"); gtk_window_set_default_size (GTK_WINDOW (window), 200, 280); GtkWidget *grid = gtk_grid

Change the window's opacity / hide it without affecting its childs

六眼飞鱼酱① 提交于 2020-01-06 01:45:26
问题 I simply have a drawing area, contained in a GtkWindow toplevel. How can I hide the window / make it fully transparent without doing that to its children too (in that case the the drawing area) ? I am aiming to the case in which everything drawn by the program is just the canvas drawing. 来源: https://stackoverflow.com/questions/32534734/change-the-windows-opacity-hide-it-without-affecting-its-childs

How to avoid closing of Gtk.Dialog in Python?

与世无争的帅哥 提交于 2020-01-05 15:08:13
问题 I have a form in a Gtk.Dialog which has an "Ok" button and a "Cancel" button. When I click on the Ok button, the dialog returns 1 and when I click on Cancel button, it returns 0. What I want to make is to validate the fields of the form so that if any field has invalid data, like letters in a numeric field or empty fields, the dialog can not be destroyed if Ok button is pressed. 回答1: You could define a custom dialog. Here you can find an example. Make shure to destroy the dialog only if your

GTK3: Getting a style's class property

你离开我真会死。 提交于 2020-01-05 08:07:49
问题 I'm trying to get the text color of a class of a GTK style. I have a GtkStyleContext with the widget path and the classes that I want to get their properties. GtkWidgetPath* widgetPath = gtk_widget_path_new (); gtk_widget_path_append_type(widgetPath, GTK_TYPE_WINDOW); gtk_widget_path_iter_set_name(widgetPath, -1 , "UnityPanelWidget"); GtkStyleContext *context = gtk_style_context_new(); gtk_style_context_set_path(context, widgetPath); gtk_style_context_add_class(context, "gnome-panel-menu-bar"

GTK3: Getting a style's class property

心已入冬 提交于 2020-01-05 08:07:03
问题 I'm trying to get the text color of a class of a GTK style. I have a GtkStyleContext with the widget path and the classes that I want to get their properties. GtkWidgetPath* widgetPath = gtk_widget_path_new (); gtk_widget_path_append_type(widgetPath, GTK_TYPE_WINDOW); gtk_widget_path_iter_set_name(widgetPath, -1 , "UnityPanelWidget"); GtkStyleContext *context = gtk_style_context_new(); gtk_style_context_set_path(context, widgetPath); gtk_style_context_add_class(context, "gnome-panel-menu-bar"

How can a program that uses GUI be constructed?

末鹿安然 提交于 2020-01-05 06:41:09
问题 I have just started Python, about 2 weeks ago. Now, I am trying to create GUIs with PyGObject using Glade. However, I am puzzled on how the general layout of the program should be. Should I use a class for the main program and the signals or should I separate them? Is there a "best approach" for this? Or as in below humble approach of mine, should I not use classes at all? How do I communicate between functions in the below example? For example, how do I set parent parameter of Gtk

How to change data of a GtkTreeModel (within “edited” callback)

 ̄綄美尐妖づ 提交于 2020-01-05 05:44:28
问题 I'm catching the "edited" signal of my GtkCellRenderer: GtkTreeModel * sortmodel; // contains a sorted model of GtkListStore // ... GtkCellRenderer * renderer; // ... g_object_set(renderer, "editable", TRUE, NULL); g_signal_connect(renderer, "edited", G_CALLBACK(onEdited_name), sortmodel); I'd now like to change the content of the cell accordingly, but I don't find any function, that would change the content of a cell of a GtkTreeModel. void onEdited_name(GtkCellRendererText *cell, gchar *

Segmentation fault while drawing frame from webcam to DrawableArea in pygtk3

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-05 04:06:12
问题 As title suggests I am reading frames from my webcam (using openCV, i want to do some follow up feature detection with it) and want to write the result to a pyGTK3 DrawableArea widget. Following this answer, which i will quote for convenience: The following seems to do the job: def draw(self, widget, context): Gdk.cairo_set_source_pixbuf(context, self.pixbuf, 0, 0) context.paint() One question still remains: Is this the preferred way of doing things? So i am now using: def _on_drawablearea

Customizing GtkTextTag appearance thru GTK3 CSS stylesheets?

爷,独闯天下 提交于 2020-01-05 04:05:29
问题 I have some GtkTextTable*mom_tagtable; which is the tag table of a GtkTextBuffer *mom_obtextbuf; (which is shown in two text views GtkWidget *mom_tview1; & GtkWidget*mom_tview2; ). I'm using GTK3.21 on Linux/Debian/Sid and it is for the same (free software, GPLv3) application than in this other question: the expjs branch (on github ) of the MELT monitor. BTW all the GTK code is in one C99 file gui.c. I have a few dozen of text tags: static GtkTextTag *mom_tag_toptitle; // tag for top text

GTK3 function keys; which are consumed (and unusable from my GTK app)?

可紊 提交于 2020-01-04 07:06:09
问题 FWIW, the exact program motivating this question is (on Linux/Debian/Sid/x86-64) my bismon on github, commit d43a75fb9f8e13. GTK3 is 3.22.24. If you need to try it, build it with make and run ./bismon . It is in alpha stage, and still not interesting to others than me. It is some kind of DSL interpreter with a GTK interface and a persistent heap. If you want something to appear, click to focus on the middle widget, type the_system there followed by Ctrl Return , but that is not relevant for