I am looking for a way to completely hide the cursor in Rhino via Python/RhinoCommon script.
Similar way to this WinApi function would do it:
I tried using System.Windows.Forms and ShowCursor/HideCursor, but it doesn’t work globally in Windows.
Any ideas?
I’d like to have run one script that hides the cursor, and another one that shows it, if at all possible.
Can you post the whole code?
The first 3 lines do nothing over here…
So have you managed to run the script that keeps the cursor globally (all windows) hidden, until another script runs and shows it? That’s precisely what I need. Thanks!
OK, maybe this is different in Win7 and Win10. I’ve tried on the first.
No, it only hides the cursor over Rhino and the form. I think that as i user i would really get pissed if anyone hides my cursor globally. How would you run the other script to show the cursor if you have no indication where your mouse is ?
I only care to hide it in current Rhino vport and can detect if the cursor is in viewport or not, and show it instantly once it hits the toolbars/panels area. I actually did that in RhinoScript / WinApi but now trying to reproduce it in Python with no luck. Windows 10 here, but I literally just tried the 3 lines, did not create the form
There is a master script that runs both of these scripts separately
Hi @Jarek, i take no responsibility if you cannot see your mouse cursor with below code. On my system, this hides the cursor over Rhino and the form and the python editor, it comes back if i manage to close the form. Note this is a modeless window…
Hi @Clement - that works great (meaning: hides the cursor until I close the window), in Rhino only.
Now I need to figure out how to do it while not seeing this window, and show it not only when closing it. But it’s a good start. Thanks!
this will make your form invisible but still open and it responds to key shortcuts when the focus is on it. I would suggest to add some controls to the form or at least some text, otherwise it might be hard to find…
_
c.
Turns out, just two lines of code are enough, with no need to create the form:
import System
System.Windows.Forms.Cursor.Hide()
and
import System
System.Windows.Forms.Cursor.Show()
The problem I have now is determining if cursor is hidden or shown since this is not just a boolean operation. Looking and the documentation, the number of hide and show calls must be equal, so if I run “Show” 3 times, the “Hide” needs to be ran 3 times before it hides. So far I don’t know how to ‘know’ what the state of the cursor is…