I am going to create a GUI screen using Pyqt5 for the first time.

The code is written by accessing Ubuntu on Virtual BOx remotely from Tera Term.

GUI code in PyQt5 and python3 [1] Copy and paste and start with a clean window.

#-*-coding: utf-8-*-
import sys
from PyQt5.QtWidgets import *
def main ():
    app = QApplication (sys.argv)
    w = QWidget ()
    w.resize (250,150)
    w.setWindowTitle ('Window01')
    w.show ()
    sys.exit (app.exec_ ())
if __name__ == '__main__':
    main ()

When this is executed on Tera Term,

qt.qpa.screen: QXcbConnection: Could not connect to display
Could not connect to any X display.

I get an error. When I ran it on an Ubuntu terminal, a clean window was displayed without any problems.
Can this window be displayed on the host Windows OS instead of Virtual Box Ubuntu? ?

Thank you for teaching me.

  • Answer # 1

    I think X11 forwarding etc. should be examined. I think some effort will be required.

    You can also use Virtual Box seamless mode. However, this is a "what a" method.

    It doesn't run on the host's windows anyway, so if you want an application that runs on the host, you can run python on the host.