I need to do the keyboard detect
crazyCoder691 (6)

first off, I use "</>" to detect code
I always use the code in python:
</>
if keyboard.is_pressed(this key)
"do this"
<>
it simply does not work on my repl.
I'm trying to do this:
</>
print("1. Play a new game")
print("2. Play a 1-Player version(using random variable)")
print("3. How to Play")
print("Type Option:")
if keyboard.is_pressed("1")
from twoplayer import play
<>
the "twoplayer.py" is a file that I have already made with a function called play. If it works it should print hello
this is the code in twoplayer.py
</>
def play():
print("hello")
<>
I am getting this error about invalid syntax on the if keyboard.is_pressed(1) line!!! This worked perfectly on IDLE!!!
Does anybody have an alternative?

You are viewing a single comment. View All
Answered by crazyCoder691 (6) [earned 5 cycles]
View Answer
crazyCoder691 (6)

I ALREADY tried that! The one that you suggested, the keyboard.