我最近用python启动了游戏开发,但每次尝试导入python模块时都会收到一些错误消息。
>>>import pygame
我确定我将游戏保存为game.py,我的python版本为3.4.3,pygame为1.9.2。我已经通过
检查了pygame版本println("Checking login details")
if(userEmail.isEmpty || userPassword.isEmpty || userRepeatPassword.isEmpty){
displayMyAlertMessage("All fields are required")
println("Fail to login not all fields where fill")
return
} else if(userPassword != userRepeatPassword){
displayMyAlertMessage("Passwords do not match.")
println("Fail to login password does not match")
} else {
var uiAlert = UIAlertController(title: "Alert", message: "Registration was successful", preferredStyle: UIAlertControllerStyle.Alert)
self.presentViewController(uiAlert, animated: true, completion: nil)
uiAlert.addAction(UIAlertAction(title: "Ok", style: .Default, handler: { action in
dismissViewControllerAnimated(true, completion:nil)
}))
}
并且没有错误发生,这意味着我有正确的版本? 所以我不仅可以导入pygame的模块。请帮帮我!
答案 0 :(得分:0)
试试这个:
import pygame
import pygame.locals as locals
from locals import *