Questions tagged [gtk4]
GTK4 is the fourth version of a popular cross-platform widget toolkit written in C. GTK4 offers a range of UI elements that are suitable for projects ranging from small individual tools to complete application suites. Even though it's written in C, it supports a large number of languages, such as Python, JavaScript, C++, Rust, and more. GTK is released under the terms of the GNU Lesser General Public License.
gtk4
287
questions
1
vote
1
answer
30
views
How to find child widget by name and type on gtk4?
I am trying to find child widgets by name/type from GtkStack. This function is working on gtk3--------
GtkWidget* find_child_by_name (GtkWidget* parent, const gchar* name)
{
printf("GtkWidget ...
1
vote
0
answers
15
views
How to auto move GtkWindow on current focused workspace?
I'm trying to automatically move the window to the focused workspace. That is, when I change the workspace, the Gtkwindow will automatically move to that workspace. I tried the script below but it is ...
1
vote
2
answers
66
views
How do I set attributes (particularly color) of a GtkTextView in GTK4 in C?
Thanks in advance for the help.
Here's the situation:
I would like to set up an interaction that changes the background color of a GtkTextView under certain circumstances, e.g. if it's focused.
I ...
2
votes
0
answers
39
views
How to take screenshot in gtk4?
I am trying to take a screenshot of the root window in gtk4. This is how I do it in gtk3--
GdkWindow *root_win = gdk_get_default_root_window();
gint width = gdk_window_get_width(root_win);
gint ...
1
vote
1
answer
33
views
How to move a shape on cairo surface by GtkEventControllerScroll (scroll event)?
I am trying to move a shape(circle) on GtkDrawingArea by scroll event(GtkEventControllerScroll). I tried the following code, but it is not working. I tried to move it only horizontally. The default ...
0
votes
1
answer
35
views
gtk_window_set_titlebar() is not supported for AdwApplicationWindow
Trying to make a GTK 4 app with Adwaita on Python on Windows.
Here are my imports:
import gi
gi.require_version('Gtk', '4.0')
gi.require_version('Adw', '1')
from gi.repository import Gtk, Adw
So, ...
0
votes
2
answers
37
views
How do I use CSS in PyGObject with Gtk 4?
I'm trying to create a little application with PyGObject and Gtk 4.0. All of the other answers were for Gtk 3 or below, and trying them gave me an error.
I tried this piece of code:
css = '* { ...
2
votes
1
answer
41
views
Why does GtkText's context menu (copy, paste) stop working; If css border is applied on GtkText?
I want to apply a border to GtkText Widget using css but facing issue. If I apply the border via CSS, the copy paste option in the default right click context menu stops working. Showing this warning -...
1
vote
2
answers
59
views
How to Apply CSS to GTK Application Elements Using CSS Selectors
I'm developing a C++ GTK application and I'm trying to implement a dark mode theme using CSS. I've created a style.css file with the necessary styles, but I'm having trouble applying these styles to ...
1
vote
1
answer
61
views
How to set background color of selected text of GtkText widget with css?
I am facing issue to set background color of selected text in GtkText widget. I tried this way, but it didn't work!
can anybody check it ? --
static const char *css =
".one text.selection {"
...
1
vote
2
answers
87
views
Changing Background Color of Window in Gtk4
I'm using glade to design an application for a gtk4 program. I convert the xml code that's gtk3 into gtk4 code because glade isn't ported into gtk4. I tried connecting the window that I want to have ...
0
votes
0
answers
52
views
How to create a simple GTK app with menu bar and button with Rust?
I can't seem to find a way to create menubar and a simple button.
With my current code, it will spawn two windows at the same time - one is just one big button and the other one is a file menu.
let ...
1
vote
0
answers
32
views
How to draw a circle in Gtk GLArea, which can be moved by mouse motion event?
I want to make a circle in Gtk GLArea. Which can be moved with the help of the mouse pointer. Here is a script, on which i want to draw the movable circles. Can anyone tell me how to do this?
//gcc $( ...
0
votes
1
answer
47
views
Adding a polkit policy to a python GTK app, what am I missing?
I'm currently making my first python+GTK4 and I need to use some pkexec command for having root permission for stuffs like dnf install, dnf list, ecc.
I'm posting because I'm trying from a few days to ...
0
votes
1
answer
94
views
How to set css radial-gradient (drawing) on cairo surface in gtk4?
I am trying to draw circle on Gtk4 GtkDrawingarea using CSS. And then clicking on it, it will save as a PNG file. But unable to get the drawing (gradient) from drawing area to cairo surface (...