I'm building a GTK GUI in Python and I need to get some data from the database which takes quite long, so the GUI freezes.
So I'm now using Threads to run the refreshing "in the background":
Thread(target=self.updateOrderList).start()
I have GUI class with alle relevant methods to manipulate the GUI. My solution work 80% of the time, but when it doesn't GTK crashed and it outputs this:
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
python3.6: ../../src/xcb_io.c:165: dequeue_pending_request:
The other times it works good, the data get loaded and its refreshing the gui.
edit: Sometimes I get this error:
Gdk-Message: 11:13:42.848: main.py: Fatal IO error 11 (Die Ressource ist zur Zeit nicht verfügbar) on X server :0
Sometimes I click the refresh button several times and it works, but then it doesn't at some point.
My main.py looks like this:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GObject
import gui
GObject.threads_init()
# start gui
gui.Gui()
Gtk.main()
Any ideas whats happening here?
Markus