Closed drakbar closed 1 year ago
that "works" for me, What version of pyray are you using? and how did you install pyray? make sure to use the latest one.
p.s. the gui_text_input_box takes 7 params and not just 5.
pip3 install raylib
was the method that used to install pyray
.
pip3 freeze claims that I am using raylib==4.5.0.0
That example code was something I pulled from another issue in this repo. When ever I import pyray it does dump this to the terminal as well
>>>> import pyray
RAYLIB STATIC 4.5.0.0 LOADED
Now the only caveat to my setup in that I am running in a virtual environment, which did complain a lot when trying to pip install it.
strange, that works (for me) in raylib 4.5.0.0 . Try to reinstall.
p.s. Is there a reason why you are using a virtual environment? maybe that is the problem...
Yeah the whole reason for VE is so that different versions of libraries can be installed on your system without conflicting with one another and polluting you system libraries.
It is a very crude method of isolation in order to "reproduce" a effect. A low effort attempt for something a kin to a scientific control. VE are a lighter weight / faster approach to say something like a docker container.
If you are not using virtual environments for code exploration you should really try it out. It doesn't provide you with any additional layer of security, just a method of managing dependencies.
What’s the OS and Python version?
Ubuntu 22.04 python 3.10
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
pypy
Python 3.10.12 (af44d0b8114cb82c40a07bb9ee9c1ca8a1b3688c, Jun 15 2023, 12:39:27)
[PyPy 7.3.12 with GCC 10.2.1 20210130 (Red Hat 10.2.1-11)] on linux
First, as sDos280 said, "takes 7 params and not just 5" so you will need to change that line to:
pr.gui_text_input_box(pr.Rectangle(0, 0, 800, 600), "title", "message", "buttons", pointer, 10, 0)
However, that won't solve your problem about Raygui not being found.
When you install raylib-python-cffi using pip, the binary wheel that should install is this one:
I've tested this and raygui works with it.
It's possible that for some reason pip decided to downloaded the source tarball and compile it rather than using the binary. In that case you will need to ensure that raygui.h is somewhere on the include path at the time the compile happens, e.g:
sudo cp raygui/src/raygui.h /usr/local/include/
Note if you reinstall using pip, it will probably use the cached version it compiled previously, so you will need to force it to recompile. Probably this will do that:
pip3 install --no-cache-dir --no-binary raylib --upgrade --force-reinstall raylib==4.5.0.0
actually /usr/local/include
is just my include path, you need to check what yours is like this:
pkg-config --variable=includedir raylib
and then copy raygui.h to there.
(Or just install the binary wheel I linked above, probably easier.)
@electronstudio
That was it! Your suspicion was right. I remember when I first attempted to install raylib
via pip it complained. So I built and installed the shared object from source system wide. Only after that did the pip install complete successfully.
I do know that at the time of the initial successful pip install raygui.h
was not present at /usr/local/include
. Since it was in a virtual env I don't know if the cached version that you mentioned was still floating around. The forced no cache reinstall did work however.
@electronstudio Thank you for your help!
looking at the documentation and readme at the base of the repo, it says that gui functions should be available. I have tested the following code using both
pypy
andcpython
both yield the same result. I am not sure how this python bindings work, but I assume that the symbols are loaded in from querying a list of symbols in a shared object at runtime. If so that would imply raygui functions are not in the.so
on my system. Which I thought that raygui was header only. Would love to attempt to use this binding but really want to explore the entire eco-system.here is the code that attempts to use raygui