jdf / Processing.py-Bugs

A home for all bugs and feature requests about Python Mode for the Processing Development Environment.
41 stars 8 forks source link

NameError: name 'car' is not defined. #266

Open SamuelGzz opened 5 years ago

SamuelGzz commented 5 years ago

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.

jdf commented 5 years ago

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

SamuelGzz commented 5 years ago

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

SamuelGzz commented 5 years ago

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()