Questions tagged [gtk4]
194 questions
3
votes
1 answer
Making a clickable box in GTK4
How can I make a gtk4::Box clickable in gtk_rs?
In GTK3 it seems that using an EventBox was the way to achieve this, however in GTK4:
Stop using GtkEventBox
GtkEventBox is no longer needed and has been removed.
All widgets receive all…

JShorthouse
- 1,450
- 13
- 28
3
votes
0 answers
Using GEGL with GTK 4 for a simple image viewer with pan/zoom support
I need a simple image widget with a support of panning/zooming but unfortunately it appears GTK still does not offer one. I have managed to achieve something similar by using a ScrolledWindow and a Picture backed by a PixBuf (via scaling the PixBuf…

zareami10
- 111
- 7
3
votes
1 answer
What is the GTK4 equivalent of gtk_style_context_get_property?
It appears that in gtk4, the gtk_style_context_get_property() function is gone: https://developer.gnome.org/gtk4/stable/GtkStyleContext.html .
I can't seem to find any functions in gtk4 that do what it did. Basically I want to get the border color…

Enter Display Name Here
- 103
- 2
- 8
3
votes
1 answer
Why does GTK 4 report "assertion 'GTK_IS_WIDGET (widget)' failed"?
I have created what I would consider the simplest GTK 4 application to create a window with a menubar that activates a GAction when the menu item is clicked.
#include
#include
#include
static…

Fojupin
- 51
- 3
2
votes
1 answer
Button.set_hexpand(false) doesn't stop button from expanding
I am building a GUI Application using GTK4.8.3. I want two ScrolledWindows where one (containing a ListBox) can expand horizontally and the other (containing a Button) cannot. More precisely, I want to restrict the button's ability to hexpand.
From…

Samuel Jenks
- 1,137
- 4
- 21
- 34
2
votes
1 answer
How to use eventcontroller in gtk4
I would like to add onclick event handling to a GtkBox widget. I see that only GtkButton has clicked signal, so I feel like the only option is to attach a GtkEventController to my widget.
As per the doc, gtk_get_current_event(GtkEventController…

Abraham Zsombor Nagy
- 53
- 4
2
votes
0 answers
On wayland, why is my default Gtk display an X11Display?
I'm learning GTK4 and working with wayland (hyprland) on linux.
When I try to retrieve the default display, my python code returns an X11Display.
I figured out that the GDK_BACKEND environment variable was not set to wayland.
However, my question…

David
- 33
- 3
2
votes
0 answers
How do I use Common Lisp CFFI to close all windows of an Gtk4 app?
It appears that the way to close a Gtk4 library is by closing all the windows. The gir based bindings only allow the closing of a single window.
https://docs.gtk.org/glib/type_func.List.foreach.html seems to be the way to go.
I want to pass to it…

ruby_object
- 1,229
- 1
- 12
- 30
2
votes
1 answer
How do I use SBCL sb-alien to create a Gtk4 window open it and have a simple callback that works?
The documentation is difficult to understand.
http://www.sbcl.org/manual/index.html#Foreign-Function-Interface
Part of the problem is not understanding how to implement this type
https://docs.gtk.org/gobject/callback.Callback.html
in my code.
I need…

ruby_object
- 1,229
- 1
- 12
- 30
2
votes
2 answers
How to get clipboard content with Python3 & GDK 4?
GTK4 doens't manage the Clipboard anymore, now it's done from GDK4.
I was not lucky migrating this code from GTK3 to GDK4?
from gi.repository import Gtk, Gdk
cb = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
content = cb.wait_for_text()
Any idea…

Costales
- 2,799
- 1
- 17
- 21
2
votes
0 answers
libEGL warning: DRI2: failed to authenticate
I am trying to get the example from the docs working but I keep on getting this error
libEGL warning: DRI2: failed to authenticate
I installed the packages
sudo apt install libpango1.0-dev
sudo apt-get install libgtk-4-dev
sudo apt-get install…

katysha
- 51
- 2
- 7
2
votes
1 answer
How to programmatically add a check mark to a GMenuItem (gtk4 using c)
Only GMenu, GMenuItem, GMenuModel, and GSimpleAction can be used to create menus in GTK4. Is it possible to put a check mark next to a known GMenuItem?
I've menaged to enable/disable menu item by manipulating GSimpleAction. However, there is no…

kkemic
- 59
- 3
2
votes
1 answer
How can I get user input from an entry? GTK 4 C
I'm trying to get what it's been typed in an entry and store it to afterwards use it elsewhere in my app, but I'm having a hard time trying to figure it out because functions like gtk_entry_get_text() aren't in gtk4 so I'm using an entry buffer to…

prxvvy
- 109
- 8
2
votes
2 answers
Gtk4 GestureClick no released signal emitted
When I assign a Gtk.GestureClick to a Gtk.Scale there's no released signal emitted.
See code for example.
import gi
gi.require_version('Gtk', '4.0')
from gi.repository import Gtk
class Main():
def on_activate(self, app):
win =…

swanux
- 67
- 7
2
votes
0 answers
Global Locale Warning using C++ and gtkmm
I'm working on a gui using gtkmm and everything is working, but I get a warning that I can't figure out:
** (process:28120): WARNING **: 13:08:38.752: Can't set the global locale to the user's preferred locale.
locale::facet::_S_create_c_locale…

Zico
- 127
- 16