I’m trying do code a simple app with GTK4 in Python using VS Code. What I do: I don’t have any auto completion or type hints in my IDE because gi.repository uses dynamic imports, is there any way to change this behavior? Answer In Python typing annotations can be written separately from the main module code (in .pyi files or
Tag: gtk
Gtk.Spinner in Python GTK while importing large library
I have a GTK application in C that will spawn a Python GTK process to embed a matplotlib figure into a window in the C process using GtkSocket/GtkPlug (uses XEmbed Protocol). The problem I am having is that the import of the matplotlib library takes about 2.5 seconds and during that time the socket widget is simply transparent. I would
PyGObject: How to create hamburger menu programmatically
I would like to create a “primary menu” programmatically, which I believe is also called a “hamburger menu”. I have done several of these while working on web development side, but I have never done these using Python and GTK. This topic seems to be controversial and there are a lot of different solutions out there. I would like to
GTK – Python Treeview Sort Column Data (File Size – Byte Data)
I have a GTK GUI with Python code. There is a treeview on the GUI. I need to list file sizes on the treeview and sort them by file size by clicking on the column. But it sorts files by using their sizes as string. What is the common way for sorting this files? Using string file size values (with
Gtk textview can’t set text [Python]
This is a desktop environment project,I’m try use textview make a terminal,but I got some problem,I can’t use set_buffer() function set text, My code: I trying use set_buffer() to set textview’s text(in line 56),but I got an error: When I change line 56 to bash1.set_buffer(Gtk.TextBuffer) later,I still got an error: How to solve this problem? Answer Gtk.TextView.set_buffer() takes a Gtk.TextBuffer
GtkWarning: could not open display
I am trying to run a spider on a vps (using scrapyjs which uses python-gtk2). On running the spider I am getting the error How do I run this in a headless setup? Answer First of all, you didn’t specify if you have a desktop environment (or X) installed on your server? Regardless of that, you can achieve headless setup