我找不到pygame.init()函数。请看看我做了什么。 ckim@chan-ubuntu:~$ python
Python 2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
pygame 1.9.4
Hello from the pygam
我在Ubuntu14.04上运行Python 2.7.11
我试图运行,并教我的电脑打乒乓球,但我陷入了一个pygame错误,我似乎找不到解决办法。
在运行deep_q_network.py时,我得到以下错误:
Wrapped Game Code/pong_fun.py:31: RuntimeWarning: use font: No module named font
(ImportError: No module named font)
font = pygame.font.SysFont("calibri",40)
Traceback (most recent call
abhigenie92@ubuntu:~/Desktop/pygame-1.9.1release$ which python
/home/abhigenie92/anaconda/bin/python
abhigenie92@ubuntu:~/Desktop/pygame-1.9.1release$ sudo apt-get install python-pygame
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-pygame is a
在我从ubuntu16.04升级到ubuntu18.04之后,下面的游戏代码停止了正常工作。
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
print "KEY:", event.key
if event.key == pygame.K_ESCAPE:
# The code here is executed when "Esc" is pressed.
elif event.key == pygam
我对pygame完全是个新手。在安装它并查看教程后,我运行的第一个代码块(来自教程)将我带到pygame模块,并指出找不到pygame.base。它根本找不到其中的任何一个:
from pygame.base import *
from pygame.constants import *
from pygame.version import *
from pygame.rect import Rect
from pygame.compat import geterror
import pygame.rwobject
import pygame.surflock
import pygame.co
我正在运行一个discord.py机器人,我希望能够通过空闲控制台发送消息。我怎么才能做到这一点,而不停止机器人的其他动作?我检查过asyncio但找不到通道。我在找这样的东西: async def some_command():
#actions
if input is given to the console:
#another action 我已经尝试了pygame,但没有结果,但我也可以尝试任何其他建议的pygame。
我正在制作一个pygame代码,其中一个直升机精灵改变了它的图像3次,使其看起来像是螺旋桨在移动。我想出了这样的东西: if heli == 1:
self.surf = pygame.image.load("Heli_1.png")
if heli == 2:
self.surf = pygame.image.load("Heli_2.png")
if heli == 3:
self.surf = pygame.image.load("Heli_3.png") 我要让每一句话....05秒,变量heli从1变为2,2变
我的pygame代码
bif="images.jpg"
mif="point.png"
import pygame, sys
from pygame.locals import *
pygame.init()
screen=pygame.display.set_mode((640,360),0,32)
background=pygame.image.load(bif).convert()
mouse_c=pygame.image.load(mif).convert_alpha()
while True:
for event in pygame.
我是python的新手,想用pygame做一个游戏。我在网上看过,每个人都说先做这件事:
import pygame
from pygame.locals import *
但是,shell窗口显示:
Traceback (most recent call last):
File "...", line 2, in <module>
from pygame.locals import *
ImportError: No module named 'pygame.locals'
我是新手,所以我不知道为什么这对其他人有效。也许我还没安装什么