Name

Object

Examples
class HLine(object):  # Class definition
  def __init__(self, ypos, stroke_color):  # Object constructor
    self.ypos = ypos
    self.stroke_color = stroke_color

  def display(self):  # Display method
    stroke(self.stroke_color)
    line(0, self.ypos, width, self.ypos)

# Declare and construct two objects (h1 and h2) of the class HLine(object):
h1 = HLine(20, 0)
h2 = HLine(50, 255)

background(127)
h1.display()
h2.display()
Description
Syntax
instanceName = ClassName()
Parameters
ClassName
instanceName
Related class
Updated on Wed Jan 18 17:32:21 2017.
Creative Commons License