I have a Python script, which displays images on a projector without user interaction. It calls OpenCV functions, which are using GTK backend. It runs just fine locally. When I try to run it remotely with ssh, I’m getting Can’t initialize GTK backend error: cv2.error: OpenCV(4.5.3) /tmp/pip-wheel-xjhn4aom/opencv-contrib-python_db9bf2c2b8dd41b592a48d20aac72627/opencv/modules/highgui/src/window_gtk.cpp:635: error: (-2:Unspecified error) Can’t initialize GTK backend in ..
I want to switch pages with the help of buttons in Gtk.Stack. There are 4 pages, and the title bar of the application has one forward and one back button. I want it to go to the next page when the forward button is pressed, and to go to the previous page when the back ..
I have a simple Python 3 application and it uses GTK3 GUI. The application has an application ID and two separate processes are started when the application is started: 1) Main.py 2) test1 What can be done to start the application with a single process (test1)? Here is the Python code (in the /usr/share/test1 folder): ..
I’m trying to write a small application GUI (GTK) application with Python 3.9 and PyGObject that reads from a log file and displays the data in a GUI window. In this particular case I’m trying to continuously read from the systemd Journal, which can be done e.g. with journalctl -f in via the terminal. For ..
I need to run a Python function by using GLib without freezing/interupting the GTK3 GUI. GLib.timeout_add(millisecond, function_name) is not adequate. More control is needed in my code. But it gives a warning and it does not repeat the function in every seconds when the following code is used: import gi gi.require_version(‘Gtk’, ‘3.0’) from gi.repository import ..
I am using pygobject in python. I have a multiple window app. I want to close all windows and quit the main loop, but continue execution of code If I call Gtk.main_quit all the windows keep in the screen and of course don’t respond. So I suppose I have to destroy all windows one by ..
I’m working on a little project on a Raspberry Pi, and playing with PygObject for the first time. I’m trying to scale an image, and every example I find says I need to use a flag named INTERP_BILINEAR, but I can’t find that anywhere within PygObject/Gtk. I’ve grep’ed the code base and can’t seem to ..
In this example, I’m trying to add another button (or any widget) every time a button is pressed. from gi.repository import Gtk class ButtonWindow(Gtk.Window): def __init__(self): super().__init__(title="Button Demo") self.hbox = Gtk.HBox() self.add(self.hbox) button = Gtk.Button.new_with_label("Click Me") button.connect("clicked", self.on_clicked) self.hbox.pack_start(button, False, True, 0) def on_clicked(self, button): print("This prints…") button = Gtk.Button.new_with_label("Another button") self.hbox.pack_start(button, False, True, 0) ..
I have a GTK3 GUI called by a simple Python 3 code. Icon is located in the /usr/share/icons/hicolor/scalable/actions/ directory. My current theme color is dark and icons look white. When I switch to white system theme GUI icons turn into black. But in my code icon looks as black instead of white when dark theme ..
I want to keep the application running in the background even when all it’s windows are closed. Is there a function or something to do this? I couldn’t find an answer on SO. Here is my code: import gi import sys gi.require_version("Gtk", "3.0") from gi.repository import Gtk class App(Gtk.Application): """The application manager.""" def __init__(self, *args, ..