Replies: 5 comments 3 replies
-
Looks like the console mode will need to be changed to get mouse input. Also could help with the clearing of the buffer and overall terminal experience. References: |
Beta Was this translation helpful? Give feedback.
-
Overall, mouse actions, such as clicking, are fairly easy to retrieve. However, mouse position on the terminal is hard to do, hence why not many python libraries integrate this. For windows it may just be optimizations with no mouse interaction unless inside of WSL or MSYS2 where mouse actions work out of the box. |
Beta Was this translation helpful? Give feedback.
-
@bczsalba It would involve using custom built windows API wrappers. The main WinAPI method to use would be ReadConsoleInput to read all the events from the standard input. I would be able to write a class/api based on this example. It would need to replace what is being used for input events if the user is on windows. The API would include features that can be hooked into. The hooks would include:
My idea is that I could create a thread that writes to a thread safe structure that holds a flag for screen resize and mouse move along with current screen size and mouse position. It would also hold a buffer of keyboard/mouse inputs that then can be read by whatever is reading the inputs. Let me know if you are interested in pursuing this! |
Beta Was this translation helpful? Give feedback.
-
Alternatively, there are some console modes that can be set, through the Win32 API, that can make the mouse events, and key events, get printed to Example source from my gist. Below is a GIF of it working including mouse events. |
Beta Was this translation helpful? Give feedback.
-
Sorry for not replying earlier, I had a super busy couple of weeks! I really like the second approach; it seems a lot easier to implement into the system, so long as there are no obvious drawbacks. I'd say go for it, it would be massive to have! |
Beta Was this translation helpful? Give feedback.
-
Windows ASCII API: Windows ASCII API
Seems like the Windows ASCII API is the same as what it would be on Linux.
Additions:
Beta Was this translation helpful? Give feedback.
All reactions