我遵循Coursera课程“An Introduction to Interactive Programming in Python”。在
我试着在自己的电脑上练习一些东西。我找到了可以替换CodeSkulptor的simplegui
的包“SimpleGUICS2Pygame”。在
现在,我想用这个函数加载图片:^{
所以我必须从Pygame网站安装pygame。但还是一样的错误。我不知道为什么pygame不可用。(我使用windows 8.1)。下面是我的代码,这是来自codeskulptor的一个示例:
import SimpleGUICS2Pygame.simpleguics2pygame as simplegui
def draw_handler(canvas):
canvas.draw_image(image, (1521 / 2, 1818 / 2), (1521, 1818), (50, 50), (100, 100))
image = simplegui.load_image('http://commondatastorage.googleapis.com/codeskulptor-assets/gutenberg.jpg')
frame = simplegui.create_frame('Testing', 100, 100)
frame.set_draw_handler(draw_handler)
frame.start()
非常感谢你的帮助!在
import pygame FAILED! No module named pygame
意味着Pygame不是为这个版本的Python安装的。在import pygame FAILED! DLL load failed
可能意味着您为这个Python版本安装了错误的Pygame版本。在以下是Pygame的几个版本: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
选择与您的操作系统和Python版本相对应的32位或64位。在
更新
我添加了一个小脚本来检查Pygame的安装: script/游戏机_检查.py在
相关问题 更多 >
编程相关推荐