Python:在 Windows 上的 Ubuntu 上通过 Bash 运行 pygame

标签 python windows bash ubuntu pygame

我最近安装并使用了 Bash on Ubuntu on Windows .在大多数情况下,它工作得很好。我正在尝试通过 BUW 运行 pygame 脚本,但它不会在弹出窗口中呈现图形。相反,它似乎包含在 bash 窗口中,看起来像这样:

enter image description here

这是 pygame 失败的原因吗?我可以在这里做些什么来让它运行吗?

最佳答案

Pygame 在 SDL 上运行。 ubuntu 附带的 SDL 版本需要* xserver 才能运行。了解如何在 Windows 上的 ubuntu 上使用 bash 运行 xserver。

这个问题可能会提供这些步骤:How to use X Windows with Emacs on Windows 10 Bash?

*它需要一些东西来渲染,原始帧缓冲区,正如您所注意到的,将位图渲染为 ascii 艺术的 libcaca 也很好。不过,渲染到 X 可能是您想要的。

关于Python:在 Windows 上的 Ubuntu 上通过 Bash 运行 pygame,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45297979/

相关文章:

Python从多个不同长度的列表中获取唯一对

node.js - webpack --progress 错误 : write EINVAL

windows - psql : error: could not connect to server: FATAL: password authentication failed for user

windows - 远程 OpenSCManager 失败,访问被拒绝

bash - 强制在Docker镜像中更改时区

python - 操作系统错误 : cannot open resource while trying to use ImageFont.

Python设计问题(在这种情况下可以/应该使用装饰器吗?)

python - request.args.get ('key' ) 给出 NULL - Flask

bash - Hadoop Yarn 上的 Spark 安装

bash - 终端 shell : How to use echo instead of a text file as command-line arguments