p5
p5 copied to clipboard
Having problems with from p5 import * NameError
Running the Hue Example
# Hue
#
# Hue is the color reflected from or transmitted through an object.
# and is typically referred to as the name of the color (red, blue,
# yellow, etc). Move the cursor vertically over each bar to alter its
# hue.
#
from p5 import *
bar_width = 20
last_bar = None
def setup():
size(640, 360)
title("Hue")
color_mode('HSB', height, height, height)
no_stroke()
background(0)
def draw():
global last_bar
which_bar = mouse_x // bar_width
if which_bar is not last_bar:
bar_x = which_bar * bar_width
fill(mouse_y, height, height)
rect((bar_x, 0), bar_width, height)
last_bar = which_bar
if __name__ == '__main__':
run()
Traceback (most recent call last):
File "p5.py", line 32, in <module>
run()
NameError: name 'run' is not defined
I am not sure why this is the case, i assume that the from p5 import * is not bringing it into the namespace. Although doing import p5
then placing it infront of everything doesnt help either.
I suspect this is related to #85 .