gtk

SDL_Surface into GTK Window

匆匆过客 提交于 2019-12-24 07:47:18
问题 I'm currently making a project in my IT School and I work with SDL (The project is image processing and stuff like that), and currently I just display the image with SDL without interface (buttons etc...). I know a little bit about GTK so I want to know if I can display an image (here a SDL_Surface) into a GTK window I made some research but nothing was very clear... Thank you ! 回答1: Drawing widgets using SDL Drawing widgets(menu, buttons etc) using SDL drawing functions and handling actions

gtk-back button does not remove from grid, liststore treeview row is not shown full

纵然是瞬间 提交于 2019-12-24 07:33:45
问题 I have 2 concerns: in a page when I click the list item another list with a button is added to grid, but when I press button, the 1st page comes back, but the back button is not removed from grid. list store items are not shown in full, it is truncated. How do I show the full list? #include <gtk/gtk.h> #include <glib.h> #include <stdlib.h> GtkWidget *scrolledwindow; struct param { GtkWidget* grid; GtkWidget* scrolledwindow; GtkWidget*newChild; GtkWidget*oldChild; }; GtkWidget * init_tree();

Unable to compile code with GTK

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 06:31:03
问题 I want to learn to use GTK3 but I am not able to compile the first example. I installed MSYS2 and ran: pacman -S mingw-w64-x86_64-gtk3 followed by: pacman -S mingw-w64-x86_64-glade and: pacman -S mingw-w64-x86_64-devhelp I installed it at c:\MSYS64 which is the default location but when I try and run gcc `pkg-config --cflags gtk+-3.0` -o example-0 example-0.c `pkg-config --libs gtk+-3.0` to compile the Simple Window tutorial #include <gtk/gtk.h> static void activate (GtkApplication* app,

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

How to use gtkmm with EGL

泄露秘密 提交于 2019-12-24 05:06:17
问题 I found this blog post that has an example on how to use EGL with GTK. However I use gtkmm on my project, therefore I need to find how to do things with it I need to find these functions: gdk_x11_display_get_xdisplay gtk_widget_get_display gdk_x11_window_get_xid gtk_widget_get_window gtk_widget_get_allocated_width gtk_widget_get_allocated_height on gtkmm. Their gtkmm probably return class instances, so I need to figure out how to get the C object these classes point to as well If we look at

Handling key presses in GTK+ (gtkD)

半世苍凉 提交于 2019-12-24 04:48:10
问题 I'm playing around with gtkD (a D binding for GTK+) I have a window object, instance of gtk.MainWindow . I want to handle keypresses on it. How? How do I deal with special keys (e.g. arrow keys, pgup/pgdn etc)? PS I know these kinds of questions can be answered with google and stuff, but I've seen much "simpler" questions on stackoverflow, so I figured asking doesn't hurt. Plus, sometimes, basic things tend to be burried under pages of documentation. 回答1: Here is sample code which may help

How can I retrieve from a GTK Builder the name of an object? [duplicate]

核能气质少年 提交于 2019-12-24 04:32:46
问题 This question already has answers here : Python GTK+ widget name (3 answers) Closed 6 years ago . How do I get the name of a Gtk.Widget retrieved from a Builder object? I specifically mean the name seen in Glade (eg: button1 ), not the name of the class ( GtkWindow ). This question is exactly the same as this one, but for Python with GObject introspection. 回答1: You can't use the get_name method inherited from Gtk.Widget . Instead, you have to use the get_name method defined in Gtk.Buildable ,

How can I retrieve from a GTK Builder the name of an object? [duplicate]

ε祈祈猫儿з 提交于 2019-12-24 04:32:13
问题 This question already has answers here : Python GTK+ widget name (3 answers) Closed 6 years ago . How do I get the name of a Gtk.Widget retrieved from a Builder object? I specifically mean the name seen in Glade (eg: button1 ), not the name of the class ( GtkWindow ). This question is exactly the same as this one, but for Python with GObject introspection. 回答1: You can't use the get_name method inherited from Gtk.Widget . Instead, you have to use the get_name method defined in Gtk.Buildable ,

How to make a custom nonrectangular gtklayout in GTK+3

时光怂恿深爱的人放手 提交于 2019-12-24 03:56:07
问题 When using GTK+2, we can use gtk_widget_shape_combine_mask and gtk_widget_input_shape_combine_mask to make a custom nonrectangular gtklayout. For example, in the case of a GTKLayout with a circle hole, we can see the widget bottom of the custom gtklayout through the circle hole. With GTK+3, the gtk_widget_shape_combine_mask is replaced with gtk_widget_shape_combine_region . When using gtk_widget_shape_combine_region and gtk_widget_input_shape_combine_region , we can't see the widget bottom of

Force UTF-8 encoding in glib's “g_print()”

随声附和 提交于 2019-12-24 03:51:50
问题 Short question: Is there a way to force glib's g_print() to use UTF-8 encoding? The problem I hit is that g_print() seems to do character set conversion based on the return value of g_get_charset(). Now the documentation unfortunately mentions On Windows the character set returned by this function is the so-called system default ANSI code-page. However nowadays modern consoles are available: MSYS consoles typically support (and use) UTF-8 by default and even the default Windows console can be