Zum Inhalt springen

Using Qt4 without an X-Server

4. Juni 2009
von Alex

I just wrote a small PyQt4 application, that uses this great lib to draw some lines on image files. Nothing special and nothing that I would need an X-Server for. Anyway, the application kept segfaulting, when there was no X running. So, here comes the solution:

If you use some Qt classes that don’t use the X-Server, you can tell the QApplication object, that it shouldn’t connect to it via an additional constructor argument

app = QApplication(sys.argv, True) # If X-Server is needed

app = QApplication(sys.argv, False) # If X-Server is NOT needed

I hope I saved you some searching with this.

Noch keine Kommentare

Einen Kommentar hinterlassen

Note: You can use basic XHTML in your comments.

Diesen Kommentar-Feed via RSS abonnieren.