Zum Inhalt springen

Using Qt4 without an X-Server

4. Juni 2009
by

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

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

Gravatar
WordPress.com-Logo

Melde Dich bitte bei WordPress.com an, um einen Kommentar auf deinem Blog zu schreiben.

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Log Out / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Log Out / Ändern )

Verbinde mit %s

Follow

Get every new post delivered to your Inbox.