I am currently working with a wxPython GUI window that incorporates an OpenGL canvas panel. My goal is to render icons on this canvas and enable mouse interactions, specifically allowing users to click on the rendered icons. I have a couple of questions regarding this process:
Mouse Event Capture: How can I effectively capture mouse events on an OpenGL canvas within a wxPython GUI?
Custom Mouse Cursor: Additionally, I am interested in changing the mouse cursor dynamically when it moves over one of the icons. Could you provide guidance on implementing this feature?
In fact, I am using OpenGL to render 3D models and require the inclusion of icons to facilitate mouse interactions. For example, clicking on one of the icons will trigger a change in the model’s action.
I’ve created a wxPython application and placed a GLCanvas in the wxFrame. I’ve bound the EVT_LEFT_DOWN event to the GLCanvas, but when running the program, the mouse click events don’t seem to respond in real-time. I have to wait until the program is closed to see that the clicked events are printed together. It feels like the main thread’s mainLoop is blocking the mouse click events. How can I make adjustments to address this, and do you have any suggestions?
Twenty years ago, when I was a young useless c/c++ programmer, I made a library based on OpenGL/glut for my purposes (to learn GL for fun). Recently, I converted it to the wxPython package for educational purposes.
This package demonstrates how the FSM framework is used to define keys and mouse “effectively”.
“Effective” is my humble opinion that means readability and ease of customization, not memory usage or processing speed.