UI logo
CS 440/ECE 448
Fall 2021
Margaret Fleck

Using python/pygames on Windows Subsystem for Linux


Compiled from various notes posted on piazza.

Step 1

Install any x forwarding software. Xming seems to work well. Another option is VcxSrv. You will need to specify the -ac flag when you start it up. (On VcxSrv this should be added to the "additional parameters" box.)

Step 2:

Run the following

sudo apt-get update
sudo apt-get install -y x11-apps
export DISPLAY=localhost:0.0
xeyes

You should now see something like this [picture of eyes]

Step 3

Add the display information to your .bashrc.

echo "export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0" >> ~/.bashrc

The following variant used to work. It may be obsolete, but I'm leaving it here in case it's needed for older machines or other versions of the software.

echo 'export DISPLAY=localhost:0.0' >> ~/.bashrc