Processing.py-Bugs icon indicating copy to clipboard operation
Processing.py-Bugs copied to clipboard

NameError: name 'car' is not defined.

Open SamuelGzz opened this issue 6 years ago • 3 comments

So im using processing with python and im following the website references and examples for OOP, im typing the same example as the website into processing and it is giving me this error about car name not defined. I literally did the same code, any help? im up to date in mac os and in processing as well in python. https://py.processing.org/tutorials/objects/ this is the example im using.

SamuelGzz avatar Mar 26 '19 09:03 SamuelGzz

Without seeing your code I can't even guess what's wrong.

jdf avatar Mar 26 '19 16:03 jdf

I´m sorry,i found teh erro, i was typin init instead of init, thanks for answering tho!!

SamuelGzz avatar Mar 27 '19 00:03 SamuelGzz

Nevermind, I'm still having the same issue but it only appears when i try to use different windows, this is my code:(in this i am only trying to make a square show up but it only works when i code this way and im use to code with different tabs when it comes to classes, anyone knows what to do so i can use the tabs in processing without having that name error??)

class player(object):

def __init__(self):
    self.x = width / 2
    self.y = height / 2

def show(self):
    rectMode(CENTER)
    fill(0)
    rect(self.x, self.y, 30, 30)

def setup(): global p size(500, 500) p = player()

def draw(): background(255) p.show()

SamuelGzz avatar Mar 27 '19 05:03 SamuelGzz