Closed cratuki closed 2 years ago
This program works as expected for me on Linux/Python 3.10.4:
from pyray import *
init_window(800, 450, "Hello")
set_exit_key(KEY_NULL)
while not window_should_close():
begin_drawing()
clear_background(WHITE)
draw_text("Hello world", 190, 200, 20, VIOLET)
end_drawing()
close_window()
What OS/Python are you on? Seems unlikely to be a Python specific issue, so I would also test Raylib itself in C to see if the problem is there.
Your sample code worked on my machine. I have found the issue. The set_exit_key call must be after init_window to be effective. If it is made before init_window, init_window seems to stomp on it and re-set escape to be the exit key. Is this expected behaviour?
I should have answered your question. I am on Linux, running Python 3.9.7.
Probably. I don't know, you would have to ask Raylib. Raylib Python CFFI is only a binding to Raylib.
Thanks. Closing.
By default, when a user presses escape in raylib, the return status of pr.window_should_close() changes from False to True.
When we use pr.set_exit_key(KEY_NULL), escape should no longer do this. My experience on 4.0.0.6 is that escape still causes window_should_close to return True after my call to set_exit_key.