Processing.py - Unknown Error on Class Definition

风格不统一 提交于 2019-12-13 10:29:55

问题


I have no idea how to fix this error.

Maybe there's an open parenthesis or quotation mark somewhere before this line?

What is wrong with this code?

Class Ribbon: # I got an error on this line!
def __init__(self, xpos, ypos, m, g):
    self.x=xpos
    self.y=ypos
    self.mass=m
    self.gravity=g
    ..

def update(self, xpos, ypos):
    ..

def display(self, xpos, ypos):
    ..

回答1:


Here is your problem:

Class Ribbon (object): 
      def __init__(self, xpos, ypos, m, g):
      self.x=xpos
      self.y=ypos
      self.mass=m
      self.gravity=g

also remember that other def must be indented properly as well



来源:https://stackoverflow.com/questions/53531121/processing-py-unknown-error-on-class-definition

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