gtk

How to send user_data with gtk signals in loop

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-29 16:20:47
问题 I have signals "make" and "send" registered in core class in main thread. I call call_make() from user class in same thread. call_make() will do some work and fetch some data from worker thread and after return it will emit signal "make". This is code of user class struct my_struct{ int cur_make_id; int cur_send_id; //there may be many id's if multiple signals } void on_send_cb(core, gpointer data){ my_struct *user_data = (my_struct *) data; printf("cure_make_id %d", user_data->cur_make_id);

How to Embed a VTK Plot in GTK GLArea Widget

社会主义新天地 提交于 2021-01-29 15:21:25
问题 How a VTK 3D plot can be plotted in a GTK GLArea widget? The examples that I found so far are for GTK2 widgets and they do not work for GTK3. System and software information: Python: 3.8.6 (x64) - GTK3 - vtk: 8.2 (x64) - Windows 10 (x64) 来源: https://stackoverflow.com/questions/65517233/how-to-embed-a-vtk-plot-in-gtk-glarea-widget

Update drawing function of a DrawingArea

杀马特。学长 韩版系。学妹 提交于 2021-01-29 09:23:11
问题 I want to update a cairo drawing inside a DrawingArea. I tried to achieve this by calling DrawingArea::connect_draw(...) with a new function as the parameter. My issue is that it does not replace the original drawing function, but calls both when showing the window. Here is an example extern crate cairo; extern crate gio; extern crate gtk; use gio::prelude::*; use gtk::prelude::*; fn main() { let application = gtk::Application::new(Some("com.example"), Default::default()) .expect(

'undefined reference to' when using GTK with CMake

我怕爱的太早我们不能终老 提交于 2021-01-29 08:31:22
问题 I'm trying to build basic GTK+ code(one of its tutorials) with CMake, but I keep getting 'undefined reference to *' where * is any GTK function that is in the code. I tried to look after guides/tutorials on this, but most of them are mostly similar to what I have. Regular compilation from terminal works without a problem using command: g++ ./test.cpp -o test `pkg-config --cflags --libs gtk+-3.0` When I try using CMake my CMakeLists.txt is: cmake_minimum_required(VERSION 3.0.2) project(gtktest

Query cursor position with GTK

不问归期 提交于 2021-01-29 07:57:32
问题 Is there a way to query the cursor position using the GTK C libraries? I am writing a program where I need to read out the position of the cursor in real time (either through a callback function or by polling the values to look for change). I have scanned through the GTK documentation, but I couldn't find anything obvious that exposes the cursor position. I am currently writing this program using the GTK C libraries because a) I already have some code written in C to interface with the low

gtk_list_store_clear() function raises Segmentation Fault in C

北城以北 提交于 2021-01-29 03:00:20
问题 I am writing a program using GTK in C. I am using GtkListStore to display some data coming from a database. After a particular signal I want to remove all the rows in the GtkListStore. I used gtk_list_store_clear() function, but it raises Segmentation Fault. What is wrong with my code? //Globally declared GtkListStore *liststore2; //Inside main() function liststore2 = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststore2")); //Inside signal handler function gtk_list_store_clear

Cannot Overlay over Gstreamer Video with Gtk.Overlay

主宰稳场 提交于 2021-01-28 08:36:33
问题 I have a project with Python, PyGObject (Gtk 3), and GStreamer (0.11) I have video in my application, so I'm using a Gtk.Overlay widget so I can put other visual elements over the video background. (I need this, trust me.) (Due to the number of widgets, and the need for specific positioning and overlaying of these widgets, I'm using a Gtk.Fixed container.) However, in using the Gtk.Overlay object with anything added via "overlay.add_overlay(widget)", the video is no longer visible at all. I

[GTK]Is it possible to achieve Glass/Blur effect in GTK?

别来无恙 提交于 2021-01-28 07:13:38
问题 I was wondering if it's possible for any widgets to acquire MacOS-like blurry transparent background. Deepin Desktop Environment is able to emulate this on their context menu with Qt. Windows is slowly adopting this style after they dropped aero. Also, I was wondering if there's any way to ship a GTK application that do not follow user themes/fonts in *nix desktops so I can lock it down with my own CSS style. Thanks in advance. 回答1: not yet, but there is currently in development a gskblurnode

GTK passing structure to callback function in C

对着背影说爱祢 提交于 2021-01-28 05:01:04
问题 Still new in GTK, now trying to work on event-driven programming and stuck in weird situation: there is no problem to send scalar items to callback function, but then it comes to sending struct to it, still receiving the error with no idea what's wrong. Sample "stub" code is: #include <gtk/gtk.h> #include <stdlib.h> void messageup(); void exiting(); struct data{ char *message; GtkWidget *window; }; int main (int argc, char *argv[]) { GtkBuilder *builder; GtkWidget *window; GtkWidget

Passing user data with glade/gtkbuilder

独自空忆成欢 提交于 2021-01-28 04:03:03
问题 I am a newbie of glade/pygtk. I am doing with some radio menu items. I created a signal handler on the signals tab, handler: on_group_menu_change user data: 7 what I expected is pass the int(or str) value 7 as user param to the handler. However, at startup, I found such warning: Could not lookup object 0 on signal group_changed of object radiomenuitem1 I know gtkBuilder treat 7 as an object reference. So how can I just pass an int/str to the handler ? 回答1: It seems this is still on the Glade