Questions tagged [pygtk]
PyGTK is the Python binding for the GTK+ widget library.
2,243
questions
0
votes
0
answers
9
views
How to change differnt treeviews headers different colors
I have 3 different treeviews in 3 different windows, the last window opened by the second window, and the second window opened by the first, and what I'm trying to do is change the header row color ...
0
votes
0
answers
17
views
How to use a socket as the pty in libvte?
The goal is to create a remote terminal emulator that runs on machine A which controls machine B by sending and receiving data using TCP socket connection mapped to a forked pty on machine B
machine A ...
0
votes
1
answer
19
views
How to selectively apply different stylesheets in GTK application (python)?
Let's imagine I have next code
css = b"""
.my_css
{
background-color: red;
}"""
self.style_provider = Gtk.CssProvider()
self.style_provider.load_from_data(...
0
votes
0
answers
24
views
How to add some index or ID to object or function?
There is simple example of code (python 3, linux, gtk4)
#!/usr/bin/python3
import sys
import gi
import os, fnmatch
import configparser
gi.require_version('Gtk', '4.0')
from gi.repository import Gtk,...
0
votes
0
answers
7
views
Apperance settings not staying as set
Hoping someone can help me, I have managed to get some screen changes and customization in an app I'm building via gtk_rc_parse which is good but if I change the apperance settings with my app open ...
0
votes
1
answer
25
views
show popup window from a thread pygtk make GUI freeze
I'm developing a graphical interface with pygtk 3,
In parallel with this interface, I'm running a function in a 2nd thread, which reads a file that is updated by an external program.
When the value in ...
0
votes
0
answers
27
views
PyGObject Scroll to bottom of ScrolledWindow() after adding row to child TreeView
I am building a GUI program that features a "history" that consists of an expanding list containing text entries for every action. I display this using a TreeView whose model is updated ...
0
votes
0
answers
30
views
replacement of get_data and set_data in pygtk3
In pygtk3, when using set_data, it complained RuntimeError: Data access methods are unsupported. Use normal Python attributes instead. In pygtk, I can use set_data to attach a widget to another widget ...
0
votes
1
answer
26
views
PyGTK calculator
I want to make a calculator with Python GTK. I am trying to get a button to display my text in the application. However, my function gives me this error TypeError: Calculator.clickedButton1() takes 1 ...
0
votes
1
answer
9
views
PyGtk with Gtk+3 gives illegal instruction 4
I'm on macOS Ventura with Python3. I'm trying to setup the system for PyGtk development. I installed home-brew and gtk+3 3.24.38 and pygobject3 3.44.1. When I run the following sample "hello ...
0
votes
0
answers
15
views
Change color of checkbox/checkbutton and entry box backgound and textpygtk2
I'm using a treeview that I'm trying to customize to suite my requiments or how I would like it to look, I have most of the color changing working how I'd like using modify_base/modify_text and ...
0
votes
1
answer
68
views
Create an executable from a Python and PyGTk script under windows
I wrote in Linux a script in Python which uses PyGtk. I am trying to run it in Windows and create an executable.
The only working way I found to run python and PyGtk under Windows is using MSYS2. But, ...
-2
votes
1
answer
112
views
How do I set OpenGL version for GtkGLArea in Python GTK?
I have this class below that works in Windows using OpenGL 3.0. However, in Linux this fails because it appears to be using an OpenGL 2.0 methods on an OpenGL 4.6 context. I get this error. How do ...
1
vote
1
answer
121
views
"How to update a progress bar in PyGtk with the download percentage provided by the yt-dlp api?"
I've been programming a small project in python to practice gui, however I'm a bit stuck in this part of handling a gtk progress bar.
I think the problem is related to yt-dlp blocking the main thread ...
0
votes
0
answers
17
views
PyGtk TreeView - Sort underlying model when column is sorted
I have a Gtk TreeView written in PyGtk.
I have implemented a sort when the user clicks on the treeview column header.
something like
self.liststore_model = Gtk.ListStore(YosemiteObject.__gtype__, str, ...
0
votes
0
answers
48
views
Gtk.TreeView: Possible to show tooltip when text of the cell is clipped?
I want to show the full text of a cell as a tooltip, when the text is too long and clipped. Is that possible with GTK3 TreeView?
If you don't understand what I mean, suppose a TreeView like below. ...
0
votes
0
answers
129
views
Theme parser error: Expected a valid color
I want to change the color of the "checkmark" icon to blue, but the color does not change.
Instead, I get following error:
(main.py:23000): Gtk-WARNING **: 15:13:17.402: Theme parser error: ...
0
votes
0
answers
40
views
Python GTK, how to make MessageDialog grow depending on the child widget's height?
I was using C# GTK (Gtk#), but when I asked ChatGPT how to add a scrollbar to MessageDialog, it answered in Python, and it seems Python GTK is more popular than C# GTK, so I tried to test in in Python....
0
votes
1
answer
243
views
How to render OpenCV frames in OpenGL 3.2 GtkGLArea in Python?
How do I render images captured by OpenCV in OpenGL 3.2 GtkGLArea in Python? Many of the examples online are 10 years old, outdated and are using OpenGL 2.1 or 1.1 examples.
The only way I can do this ...
0
votes
1
answer
213
views
CSS styling for Gtk Widgets not working (Python, Gtk4)?
In my app I want some kind of profile picture a user can have. At first wanted to use libadwaita's Avatar widget, but it cannot load images from a file, which is a feature that I need. So I thought I ...
0
votes
1
answer
166
views
How to enable GPU rendering in Python Gtk3 in Windows?
I noticed that Gtk in Windows seems to be rendering images using the CPU rather than the GPU (whereas in Linux this does not seem to be the case).
I am creating a program using Python, Gtk3, and ...
0
votes
0
answers
47
views
PyGTK Not possible to change label's markup with variable from a different process
I've created an application in Python GTK and I am also using zeromq to connect with a different program. I am receiving a variable from client program and I store it inside shared_memory. The problem ...
0
votes
1
answer
35
views
Prevent ListBoxItems from being resized (specifically shrunk)
I have a Gtk Listbox to which I'm adding a large number of items (basically text labels). I've put the ListBox inside a ScrolledWindow but if I add too many items then the height of each item is ...
1
vote
1
answer
62
views
How do I horizontally center a fixed-size widget inside a VBox?
This code draws a window with some buttons in it:
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
window = Gtk.Window()
box = Gtk.VBox()
window.add(box)
...
1
vote
0
answers
97
views
p4v: You need to get version 2.0 (or later) of PyGTK for this to work
I installed p4vasp and I am getting an error which I am not able to resolve.
You need to get version 2.0 (or later) of PyGTK for this to work. You
can get source code from http://www....
0
votes
0
answers
111
views
Using GLib.IOChannel to send data from one python process to another
I am trying to use GLib.IOChannels to send data from a client to a server running a Glib.Mainloop.
The file used for the socket should be located at /tmp/so/sock, and the server should simply run a ...
2
votes
0
answers
103
views
What are the responsibilities of size_allocate() in a custom container class? How does it relate to adjust_size_allocation()?
I try to create a proper container Class for Gtk in Python (MyBin in the code below). There seems to be no authoritative documentation on how to do that, only bits and pieces, which I glued together ...
0
votes
0
answers
55
views
How do I setup VSCode Python to debug code hosted in another app?
I'm new to Python, but have experience with VSCode. I'm trying to debug a Python plugin running on a PyGTK-based application using VSCode, but I suspect my configuration is incorrect.
I can attach the ...
1
vote
1
answer
284
views
how to get rid of padding around Gtk.Image in Gtk.Box / Gtk.Grid in gtk4?
I'm trying to write a simple GUI using Gtk4 (in Python), but I'm having trouble with getting rid of padding (and I don't understand why the padding is there).
The goal is pretty simple - I need a Gtk....
0
votes
1
answer
76
views
python Gtk3 - Set label of button to default value of None
I am trying to reset a label of a button to its initial (default) value of None, which does not work as expected. Here's the minimal example:
from gi import require_version
require_version('Gtk', '3.0'...
1
vote
1
answer
303
views
Python 3 + GTK 4 - Buttons with pictures and labels look weird
I develop a simple app for Linux, Kamarada Firstboot (source on GitLab), using Python 3 and GTK, and I'm migrating from GTK 3 to GTK 4. In case you are curious, you can see it in action if you ...
0
votes
1
answer
52
views
How to Pygtk WindowTypeHint to DOCK on XFCE and have it visible on the desktop
So I've run into an issue where whenever I set the WindowTypeHint to anything other than normal the window just disappears. I've verified the hint type with print.Below is my sample code
import gi
gi....
0
votes
1
answer
145
views
GTK freezes when opening dialog if user is moving the main window
The following code freezes when a user is moving the main window, and a dialog box will pop up.
https://i.stack.imgur.com/Y1n87.jpg
Has anyone noticed this problem before?
I'm using idle_add to ...
0
votes
1
answer
149
views
How can I access the Gtk.Box in Gtk.Dialog?
I get an error (Gtk-WARNING **: 18:33:56.632: Attempting to add a widget with type GtkBox to a GtkDialog, but as a GtkBin subclass a GtkDialog can only contain one widget at a time; it already ...
1
vote
0
answers
126
views
How to register an enum with the GObject type module in python?
I'm trying to port some existing Perl code to Python:
package My::Package;
use strict;
use warnings;
use Gtk3 -init;
BEGIN {
Glib::Type->register_enum( 'My::Package::Enum', qw(value_one ...
0
votes
0
answers
88
views
Are there any ways to loop in a button press callback method until the button is released?
So im using gtkmm specifically here.
What I'm working on:
I'm implementing a feature in which when I press in a certain window a parameter is increased/decreased depending on if the mouse moves left/...
0
votes
1
answer
94
views
Switching from WebView to another under GtkScrolledWindow
I am trying to create a simple web browser with already-opened multiple tabs using WebKitGtk2 and Python. I want it such that if I click a button, the GtkScrolledWindow will drop its current viewport (...
0
votes
1
answer
235
views
GTK Tree View # How to remove or hide the toggle button in column
There is defined a GTK tree view and one of the column is rendered the toggle button. Now every row is showing the toggle button, is there a way to remove or hide the toggle button from some row ...
0
votes
0
answers
100
views
Is there a Way to Toggle GTK Switch to OFF state under a specific condition in Python, programmatically?
I Am trying to set a GTK Switch to OFF state ,from ON State, without the human intervention such as mouse click or keyboard key press.
So is there any way to toggle switch states via Python+GTK ?
Any ...
0
votes
1
answer
123
views
GTK Dialog constructor cannot be used to create instances of a subclass MessageDialog WTF
When I run the following code:
dialog = Gtk.MessageDialog.new(
None,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.QUESTION,
Gtk.ButtonsType.YES_NO,
...
0
votes
0
answers
208
views
Python Gtk 3.24 - AttributeError: type object 'Gtk' has no attribute 'Builder'
This attribute error appeared when I try to run my code using Gtk and Python. Would anyone know how to solve it? This is my code:
import gi
gi.require_version('Gtk','3.0')
from gi.repository import ...
1
vote
1
answer
59
views
What's the closest widget to implement this after-effects feature in Gtk
wisgetwas wondering what widget in gtk (using gtkmm) could be used to implemented the movable button looking thing in the picture. and also the dotted line.
dotted line
edit: the widget is supposed to ...
0
votes
2
answers
48
views
PyGTK entry.set_placeholder_text doesnt work - missing tex
I am attaching a piece of my code in which I try to display the text in the Entry field with predefined text. I use entry.set_placeholder_text for this, but unfortunately the text does not appear.
Is ...
0
votes
0
answers
37
views
Gtk how to bring my app to foregrout when it is minimized or in another workspace
I am trying to develop a simple Gtk app which should be launched with a custom shortcut.
Right now, I call the following methods to present the window to the user:
# if the user executes the same ...
-1
votes
1
answer
61
views
Pygtk Liststore most recent call last after Liststore update
I created simple code in PyGtk that displays a list of names. After clicking the Update button, the list of names will be updated. Unfortunately, I can't get rid of the "most recent call last&...
1
vote
0
answers
32
views
pyGTK3 issue refreshing combobox with button on Linux
I'm trying to implement a button that updates the content of the ListStore 'attached' to a ComboBox.
Here is the combo part :
class SelectCam(Gtk.Box):
def __init__(self):
Gtk.Box.__init__(...
1
vote
1
answer
723
views
Drag and drop with GTK4: connecting DragSource and DropTarget via ContentProvider for derived classes
I am working on (py)gtk4's drag-and-drop functionality and I hit a wall. I have a flowbox-derived class MediaGallery that contains frames with images and their filenames (class MediaFile), and a ...
0
votes
1
answer
532
views
How to connect to MediaPlayer2.Player PlaybackStatus signal using pygtk?
I actually want to display the information about the media or song currently being played with a window as a popup containing the artwork and the song name etc. I read about that a
PlaybackStatus
...
2
votes
1
answer
119
views
Python GTK+ 3: Accessing MenuButton from Popover?
I'm new to GTK+ programming, and I want to do the following: I have a MenuButton with a Popover. The Popover has a Button inside. After I click the inside button, I want to be able to access the ...
0
votes
1
answer
303
views
Editable label in Python GTK+ 3?
I'm new to GTK programming. I want to have a Label widget whose text can be edited, kind of like this: https://docs.gtk.org/gtk4/class.EditableLabel.html.
The problem is I have no idea how to ...