Questions tagged [gtk]

GTK (formerly GTK+) is a toolkit for creating graphical user interfaces (GUIs) with cross platform compatibility and an easy to use API.

GTK is written in C, and has bindings to many other popular programming languages such as C++ (), Python (, ), C# (), and Perl, among others. GTK+ is licensed under the GNU LGPL 2.1, allowing development of both free and proprietary software with GTK+ without any license fees or royalties.

"GTK" stands for GIMP Tool Kit. It was originally developed to serve as the widget set for The GIMP, the GNU Image Manipulation Program. In the intervening years its usage has expanded greatly.

This tag should be used for questions about GTK in general. For more specific questions regarding how a certain version works, use or .

Reference GTK 3 documentation: http://developer.gnome.org/gtk3/stable/

Reference GTK 2 documentation: http://developer.gnome.org/gtk2/stable/

GTK Java binding - http://java-gnome.sourceforge.net/

GTK 2 Perl binding - https://metacpan.org/pod/Gtk2

GTK 3 Perl binding - https://metacpan.org/pod/Gtk3

Books:

SO Chatroom:

8468 questions
15
votes
2 answers

Programmatically open Mac Help menu

I'm integrating a GTK# application into Mac OS X. GTK on Mac OS X is a wrapper over some Cocoa and Carbon fundamentals. We have some platform-specific stuff directly using Carbon global menu APIs (it's more low-level and flexible than Cocoa, and we…
Mikayla Hutchinson
  • 16,113
  • 2
  • 44
  • 50
15
votes
3 answers

GLib-GIO-ERROR**: No GSettings schemas are installed on the system

Unfortunately, I am using Windows (Windows7 x64). With MinGW compiler in Code::Blocks and GTK+3.6.4. I compiled manually all the schemas from glib. When I use File Chooser dialogue / colorpicker - it doesn't matter, I am getting the following…
DeltaProxy
  • 208
  • 1
  • 2
  • 7
15
votes
4 answers

Gtk3 replace child widget with another widget

I'm looking for a way to remove a widget from its parent (whatever that may be - a VBox, a Grid, ...) and add a substitute widget in its place. I found this answer, but I can't seem to make it work with Gtk3. Here's what I tried: from gi.repository…
Aran-Fey
  • 39,665
  • 11
  • 104
  • 149
15
votes
2 answers

How do you find the absolute position of a GTK widget in a window?

I can use GTK "allocation" function, but that only gives the position relative to its parent. How does one find the absolute position of a GTK widget inside of a window? Ie, if the widget appears 500 pixels in, and 300 pixels down, but is nested…
user129975
  • 3,395
  • 4
  • 19
  • 16
15
votes
3 answers

Statically linking GTK+ libraries in windows

I have installed GCC and GTK+. Its working fine, but i need to statically link GTK+ libraries with my application (it's a small application) so that there exist only one '.exe'.
Khan
  • 429
  • 7
  • 14
15
votes
4 answers

ImportError: No module named gi.repository Mac OS X

I am installing virt-manager0.10.0 on Mac OS X First I installed python,libvirt, gtk+3, pygtk, and other dependencies with homebrew But when I run virt-manager I got this error from gi.repository import GObject ImportError: No module named…
MKT
  • 655
  • 1
  • 6
  • 18
15
votes
8 answers

Simple tool/library to visualize huge python dict

I have a huge dict structure like this one: my_data = { 'key1': { '_': 'value1': 'aaa' }, 'key2': { '_': 'value2': 'bbb', 'key2.1': { '_': 'ccc', 'key2.1.1': { '_': 'ddd' …
lig
  • 3,567
  • 1
  • 24
  • 36
15
votes
2 answers

How to have drag-and-drop and sorted GtkTreeView in GTK3?

I am porting liblarch, a library for handling directed acyclic graphs, from PyGTK (GTK2) to PyGObject introspection (GTK3). I ran into the problem with GtkTreeView. The app using liblarch needs to sort GtkTreeView by a column but in the same time,…
izidor
  • 4,068
  • 5
  • 33
  • 43
14
votes
2 answers

How to capture Enter key press in GtkEntry

I am trying to capture the Enter key when it is pressed in a GtkEntry. Most of the resources I have found suggest connecting to the activate signal, but the documentation for GtkEntry states (emphasis mine): Applications should not connect to it,…
Sean Bright
  • 118,630
  • 17
  • 138
  • 146
14
votes
3 answers

Converting PIL Image to GTK Pixbuf

I am looking to see if there is another way to convert a PIL Image to GTK Pixbuf. Right now all I have is what seems to be like inefficient coding practice that I found and hacked to my needs. This is what I have so far: def image2pixbuf(self,im): …
bsktball11ch
  • 763
  • 1
  • 6
  • 6
14
votes
5 answers

Charting widget for GTK or Qt

Is there a widget for GTK or Qt that would allow me to draw stock charts like this? http://smartquant.com/openquant/openquant_chart.jpg (copy&paste the URL due to hotlinking restriction) Thanks, Joel
Joel Reymont
  • 861
  • 2
  • 7
  • 16
14
votes
1 answer

Get X/Y position of caret (input text cursor) under Xorg?

I'd like to display a popover right above where the user is typing, in any Linux app (GTK, Qt, Electron, etc.), running on X. I figured out creating the popover, now I'm trying to figure out how to get the coordinates of the input text cursor (what…
nkkollaw
  • 1,947
  • 1
  • 19
  • 29
14
votes
1 answer

Mimicing glib.spawn_async with Popen…

The function glib.spawn_async allows you to hook three callbacks which are called on event on stdout, stderr, and on process completion. How can I mimic the same functionality with subprocess with either threads or asyncio? I am more interested in…
Sardathrion - against SE abuse
  • 17,269
  • 27
  • 101
  • 156
14
votes
2 answers

How can I get the default colors in GTK?

Context In GTK 3, people can set their own themes. Even the default theme (Adwaita) is provided with two variants: a light one and a dark one. As I am writing my own widget (in python), I need to get these colors in order to avoid drawing black on…
JohnW
  • 505
  • 3
  • 14
14
votes
1 answer

Libtool think that a "library was moved" but it isn't the case

I am currently recompiling gtk+ and dependencies from source (I have no other choices). All my custom packages are installed in a specific custom point (let's call it /packages) (it can seem odd but this time again, I have no other choices). When I…
ThR37
  • 3,965
  • 6
  • 35
  • 42