to learn python I decided to make a small GUI that will interact with a web API. So without much thinking I created a virtual machine with Vagrant (ubuntu/trusty64) and installed PyQt5. I made a small script to create a window (here it is)
import sys from PyQt5 import QtWidgets app = QtWidgets.QApplication(sys.argv) main_window = QtWidgets.QMainWindow() main_window.show() sys.exit(app.exec_())
When I executed my script I ended up with this error<blockquote>
QXcbConnection: Could not connect to display</blockquote>
So I guess the problem comes from the fact that I'm using a virtual-machine without a display. Isn't there a way to make it use my Windows display just to render my program? Or do I need to install a VM with virtualbox?
Thanks for your time.Answer1:
When provisioning your VM with Vagrant, you may specify to boot to GUI, such as:
config.vm.provider "virtualbox" do |v| v.gui = true end
More information <a href="https://docs.vagrantup.com/v2/virtualbox/configuration.html" rel="nofollow">here</a>
This will then launch the Qt app, using the VM's display.