AttributeError: 'NoneType' object has no attribute 'write'

╄→гoц情女王★ 提交于 2019-12-25 10:56:10

问题


I am trying to run a game me and my friends made in python... It was sent to me by e-mail. i know i have a newer version of python but im not sure if that is the problem. This is the function we defined:

def text(x,y,text,size):
    turtle.penup()
    turtle.goto(x,y)
    turtle.pendown()
    turtle.write(text,font=('Arial',size,'normal'))

we call it here:

def home_screen():
    turtle.bgpic("bgarmy.gif")
    turtle.fillcolor("#46B347")
    turtle.fill(True)
    rectangle(-150,100,300,100)
    turtle.fill(False)
    text(-70,130,"Epicry",30)
    turtle.fill(True)
    rectangle2(-100,0,200,50)
    turtle.fill(False)
    text(-35,10,"Start",20)
    turtle.fill(True)
    rectangle2(-100,-100,200,50)
    turtle.fill(False)
    text(-70,-90,"Instructions",20)
    turtle.listen()
    turtle.onscreenclick(onClick)
    turtle.mainloop()

and when i try to run it, i get this error:

Traceback (most recent call last):
File "C:\Python33\Lets Fight1\HomeScreen.py", line 2, in <module>
import movesoldier
File "C:\Python33\lib\idlelib\PyShell.py", line 60, in idle_showwarning
file.write(warnings.formatwarning(message, category, filename,
AttributeError: 'NoneType' object has no attribute 'write'

does anyone know what this means?

来源:https://stackoverflow.com/questions/17595337/attributeerror-nonetype-object-has-no-attribute-write

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!