简体   繁体   中英

Python: running pygame through Bash on Ubuntu on Windows

I've recently installed and have been playing around with Bash on Ubuntu on Windows . For the most part it works great. I'm trying to run a pygame script through BUW but it doesn't render the graphics in a popup window. Instead, it seems to be contained in the bash window and looks like this:

在此输入图像描述

Is this a lost cause for pygame? Is there anything I can do here to make it run?

Pygame runs on SDL. The SDL version shipped with ubuntu requires* an xserver to run. Find out how to run an xserver with bash on ubuntu on windows.

This question might provide those steps: How to use X Windows with Emacs on Windows 10 Bash?

*It requires something to render to, raw framebuffers and,as you noticed, libcaca, which renders bitmaps to ascii art, are also fine. Rendering to X is the one you probably want, though.

From the FAQ on the page you linked to:

Can I run ALL Linux apps in WSL?

No! WSL is a tool aimed at enabling users who need them to run Bash and core Linux command-line tools on Windows.

WSL does not aim to support GUI desktops or applications (eg Gnome, KDE, etc.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM