편집 기록

편집 기록
  • 프로필 nowp님의 편집
    날짜2023.09.18

    파이썬 오류 질문드려요. AttributeError: 'Turtle' object has no attribute 'onkeypress'


    t4=t.Turtle()
    t4.shape('turtle')
    t4.color('yellow')
    t4.up()
    t4.goto(30,0)
    

    이렇게 거북이를 만들고

    def bng():
        t4.seth(0)
    def bnng():
        t4.seth(90)
    def bnnng():
        t4.seth(180)
    def bnnnng():
        t4.seth(270)
    t4.onkeypress(bng,'w')
    t4.onkeypress(bnng,'d')
    t4.onkeypress(bnnng,'s')
    t4.onkeypress(bnnnng,'a')
    t.listen()
    

    이게 프로그래밍했는데

    Traceback (most recent call last):
      File "C:\Users\82108\OneDrive\바탕 화면\터틀.py", line 55, in <module>
        t4.onkeypress(bng,'w')
    AttributeError: 'Turtle' object has no attribute 'onkeypress'
    

    이런 오류가 뜹니다. 어떻게 해결하나요? 제발 알려주세요.

  • 프로필 코딩 알려주세요.님의 편집
    날짜2023.09.12

    파이썬 오류 질문드려요.


    t4=t.Turtle() t4.shape('turtle') t4.color('yellow') t4.up() t4.goto(30,0)

    이렇게 거북이를 만들고

    def bng(): t4.seth(0) def bnng(): t4.seth(90) def bnnng(): t4.seth(180) def bnnnng(): t4.seth(270) t4.onkeypress(bng,'w') t4.onkeypress(bnng,'d') t4.onkeypress(bnnng,'s') t4.onkeypress(bnnnng,'a') t.listen()

    이게 프로그래밍했는데

    Traceback (most recent call last): File "C:\Users\82108\OneDrive\바탕 화면\터틀.py", line 55, in t4.onkeypress(bng,'w') AttributeError: 'Turtle' object has no attribute 'onkeypress'

    이런 오류가 뜹니다. 어떻게 해결하나요? 제발 알려주세요.