Hello everyone, when I use the input() function, then run it, where should I write my user input? Right now my code looks like this: `
def userInput():
whereToGo = input(“Where would you like to go?”)
userInput()
`
And when I run it, there is no where to put my input in the console. Can anyone help? Thanks
1 Like
I don’t think the Processing console can capture input like that.
How about using something that employs keyPressed()
and text()
functions to render user input in the display window –
def setup():
size(300, 300)
where_to_go = ''
def draw():
background(100)
text('where would you like to go?', 20, 50)
text(where_to_go, 20, 100)
def keyPressed():
global where_to_go
where_to_go += key
You can use a if key == ENTER
within the keyPressed()
function to detect when the user hits the enter key.
1 Like