Error when using with Pycharm
Hey I'm new to python and have been using PyCharm I have installed p5 onto pycharm using the terminal but when I try code basic stuff using mouse_x and mouse_y it says they are not defined and says RuntimeError: Could not import backend "Glfw": GLFW library not found Could I please get help
Thank you for submitting your first issue to p5py
Welcome, @GowthamKalli
You'll need to install GLFW: https://www.glfw.org/download.html
Welcome, @GowthamKalli
You'll need to install GLFW: https://www.glfw.org/download.html
I have installed it it has come as a zip file Where do I extract and put the file.
Refer to the instructions for your platform, here: https://p5.readthedocs.io/en/latest/install.html
Refer to the instructions for your platform, here: https://p5.readthedocs.io/en/latest/install.html
Hey yeah I have seen the instructions but it says download and install but it just downloads as a zip file What and where do I have to install to get the library to work?
Are you on Windows, Mac, or Linux?
Are you on Windows, Mac, or Linux?
Sorry for the late reply But I am on windows And have downloaded the windows 64bit version for the pre bianaries
In that download, you'll find a folder named lib-mingw-w64 (with three files in it). You can place this folder anywhere on your system. Then, as per the instructions --
"First locate the Environment Variables settings dialog box. On recent versions of Windows (Windows 8 and later), go to System info > Advanced Settings > Environment Variables. On older versions (Windows 7 and below) first right-click the computer icon (from the desktop or start menu) and then go to Properties > Advanced System Settings > Advanced > Environment Variables. Now, find and highlight the Path variable and click the edit button. Here, add the GLFW installation directory to the end of the list and save the settings."
The installation directory will look something like: \path\to\lib-mingw-w64
I found this issue also. It can be solved by following:
you should import builtin or from buildin import *
import p5
import builtins
def setup():
p5.size(640, 360)
p5.no_stroke()
p5.background(204)
def draw():
if builtins.mouse_is_pressed:
p5.fill( p5.random_uniform(255), p5.random_uniform(127), p5.random_uniform(51), 127)
else:
p5.fill(255, 15)
circle_size = p5.random_uniform(low=10, high=80)
p5.circle( ( builtins.mouse_x, builtins.mouse_y), circle_size )
def key_pressed(event):
p5.background(204)
p5.run()