<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to Open a Qprocess that is GUI based]]></title><description><![CDATA[<p dir="auto">I would like to open a process which has its own GUI based interface inside my app. For example I have the a label called  <em>container</em> and I like to add the output of the command <em>evince -s mypdf.pdf</em> inside that container.</p>
<pre><code>import sys
from PyQt5.QtCore import QProcess
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel


class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        self.container = QLabel("PDF Area")
        self.process = QProcess()

        self.setCentralWidget(self.container)

    def run(self, command):
        '''
            ....

            Code to attach command output ie a GUI window inside self.container

            ....

        '''
        
        self.process.start(command)


app = QApplication(sys.argv)

window = MainWindow()
window.show()
window.run('evince -s mypdf.pdf')
app.exec()
</code></pre>
]]></description><link>https://forum.qt.io/topic/139358/how-to-open-a-qprocess-that-is-gui-based</link><generator>RSS for Node</generator><lastBuildDate>Thu, 05 Nov 2026 06:01:10 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/139358.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 16 Sep 2022 08:50:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to Open a Qprocess that is GUI based on Fri, 16 Sep 2022 09:28:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/qtbuddy">@<bdi>qtbuddy</bdi></a><br />
Hello and welcome.</p>
<p dir="auto">If you are determined to use <code>evince</code> for viewing PDF then <em>my understanding</em> is that you must launch it via <code>QProcess</code>, discover which <em>window id</em> it has used (somehow) and then <em>embed</em> that into a Qt widget via the code shown at e.g. <a href="https://stackoverflow.com/a/33760341/489865" target="_blank" rel="noopener noreferrer nofollow ugc">https://stackoverflow.com/a/33760341/489865</a>.  I <em>presume</em> that "re-parents" the X window into the widget.</p>
<p dir="auto">If you do not require the <code>evince</code> external viewer then you might consider one of the ways of displaying PDF offered by Qt.  There is <a href="https://doc.qt.io/qt-6/qtpdf-pdfviewer-example.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qtpdf-pdfviewer-example.html</a> and <a href="https://www.kdab.com/browse-pdfs-in-a-qt-widgets-application/" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.kdab.com/browse-pdfs-in-a-qt-widgets-application/</a> among others, the Poppler libraries, and <code>QWebEngineView</code> can also be used to view PDF.</p>
]]></description><link>https://forum.qt.io/post/728955</link><guid isPermaLink="true">https://forum.qt.io/post/728955</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Fri, 16 Sep 2022 09:28:23 GMT</pubDate></item></channel></rss>