gtk3

Install GTK for c on Windows 10?

Deadly 提交于 2019-12-25 02:46:33
问题 Can you tell me how to install GTK on windows 10 or have a step by step guide, all the ones I've tried have not helped me. Possibly if someone also explain how to compile from cmd or prepare an IDE (code: block maybe). 回答1: Any commands I mention should be run at the MINGW shell, found here: C:\msys64\msys2_shell.cmd First update msys2 with pacman -Syu Make sure you have installed GCC...Install the required toolchain for GCC with pacman -S mingw-w64-x86_64-toolchain . When using pacman, just

Refresh child-items in a container - GTK

冷暖自知 提交于 2019-12-25 02:37:34
问题 I am developing some kind of financial calculator in c with a graphical userinterface. I am using the gtk-lib and I have encountered one problem that right that could not be solved. Its about how to dynamically update (refresh) the window and its childs - more specifically - there is one child item in the container that is a text-label. I want this label to be changed according to what is entered in the textinputfield. I am used to java where one easily can call a method named invalidate().

How to get XWindow ID in GTK3?

旧时模样 提交于 2019-12-25 01:54:24
问题 In GTK3, how do I retrieve the XWindow ID? I didn't see anything related to this in GdkWindow. In documentation, it is said there is a GDK_WINDOW_XID() macro. However, I cannot find the equivalence in Python binding. 来源: https://stackoverflow.com/questions/14732838/how-to-get-xwindow-id-in-gtk3

“key-release-event” not triggered

馋奶兔 提交于 2019-12-25 00:23:19
问题 Consider the following code: #include <gtk/gtk.h> static void stop(GtkWidget *window, GdkEventKey *key, gboolean *key_held) { *key_held = FALSE; g_print("stopped!\n"); } static void counter(GtkWidget *window, GdkEventKey *key, gpointer user_data) { gboolean key_held = TRUE; gulong signal_ID = g_signal_connect(window, "key-release-event", G_CALLBACK(stop), &key_held); for (unsigned long int i = 0;key_held;i++) { g_print("%li\n", i); } g_signal_handler_disconnect(window, signal_ID); } int main

Refresh the window after an action in GTK+

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 22:04:49
问题 I'm discovering GTK and I have multiples issues ... Here is one of them. I have a "Data" structure and a Window which contains a menu bar and a drawingArea. The area has a drawing function "DrawRefresh_callback" dedicated to draw the content described in Data. At the moment, I can draw by connecting the click signal when I create the DrawingArea : g_signal_connect(G_OBJECT(DrawingArea), "button-press-event", G_CALLBACK(Draw_callback), pData); Indeed, by doing so, I have access to the data AND

Gtk3 textview text color vs font

China☆狼群 提交于 2019-12-24 15:42:57
问题 When I create a CSS provider with gtk_css_provider_new, and load it with gtk_css_provider_load_from_data, giving it "textview { color: red; font: 30px serif; }" as the data, and apply it to a gtk_text_view by using gtk_style_context_add_provider, the result is that it changes the font size to 30, but leaves the text color as black. What do I have to do the change the text color? That it changes the font size shows that the CSS is actually working. That it doesn't change the color shows that

GTK 3 Threads management

若如初见. 提交于 2019-12-24 08:26:35
问题 I know that before we needed to use gdk_threads_enter and gdk_threads_leave but now this functions are deprecated and I'm confused about threads. Should i just add threads with g_idle_add and that's it? 回答1: For workers that are unrelated to UI stuff, use the GThread API, for anything UI related you have to use g_idle_add / g_timeout_add or attach a custom GSource to the desired event loop. In some cases you'd want to combine those - do some work in a GThread and notify the UI from there - as

GdkPixbuf.PixbufDestroyNotify - NotImplementedError - python gtk3

落爺英雄遲暮 提交于 2019-12-24 08:19:51
问题 I am trying to use GdkPixbuf.Pixbuf.new_from_data() as shown in gtk 2.x and I am passing 7 arguments. But it gives me an error that I need to pass 9 arguments. What I am doing now was working for gtk2.x . So I figured out the other 2 arguments that I need to pass. http://developer.gimp.org/api/2.0/gdk-pixbuf/gdk-pixbuf-creating.html http://developer.gimp.org/api/2.0/gdk-pixbuf/gdk-pixbuf-refcounting.html#GdkPixbufDestroyNotify One of the arguments is of type GdkPixbuf.PixbufDestroyNotify. I

GTK+3 render rectangle with selection background color

依然范特西╮ 提交于 2019-12-24 06:51:51
问题 How is it possible to render a rectangle with the background color of selections in GTK+3. I cannot find any API to do that: static gboolean draw_callback (GtkWidget *widget, cairo_t *cr, gpointer data) { auto state=reinterpret_cast<State*>(data); auto width = gtk_widget_get_allocated_width (widget); auto height = gtk_widget_get_allocated_height (widget); auto context = gtk_widget_get_style_context (widget); gtk_render_background(context,cr,0,0,width,height); cairo_rectangle(cr,0,height*(1.0

How to set size of a Gtk Image in Python

梦想与她 提交于 2019-12-24 06:11:22
问题 How can I set the width and height of a GTK Image in Python 3 . 回答1: First create a GdkPixbuf with the new_from_file_at_scale method which has the following syntax. new_from_file_at_scale (filename, width, height, preserve_aspect_ratio) Create the widget Gtk.Image with the method new_from_pixbuf which receives a pixbuf as parameter. Simple Example: import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, GdkPixbuf pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale( filename="1