1

Is it possible to change the mouse pointer icon or do other changes in the control panel with a short python script?

Pseudocode of what I want to achieve:

import os
default_cursor=os.get_system_mouse_cursor
os.set_mouse_cursor('CURSOR_CROSSHAIR')
....
My game
....
os.set_mouse_cursor(default_cursor)
terminate program

I just imported os for the sake of the example!

mathiasxx94
  • 23
  • 1
  • 8
  • you'll have to look at how that is done natively with windows commands and try to write a script that calls those commands with `os.system` or `subprocess` module – danidee Feb 29 '16 at 11:12
  • Are you writing a windows app, or just a command line app? I don't think you can affect the cursor from the command line. See the documentation [SetCursor](https://msdn.microsoft.com/en-us/library/windows/desktop/ms648393(v=vs.85).aspx). See the note: *The cursor is a shared resource. A window should set the cursor shape only when the cursor is in its client area or when the window is capturing mouse input.* – Peter Wood Feb 29 '16 at 11:25
  • Sorry for my poor comprehension. What I am trying to do is make a game with the use of matplotlib. However the cursor when hovering the plot should be a crosshair, I can't find a built in method to change the cursor in matplotlib so I'm trying to change the cursor in windows while the game is running. Your link to SetCursor I didn't understand much of, sorry for that. – mathiasxx94 Feb 29 '16 at 11:44
  • The [matplotlib examples](http://matplotlib.org/examples/index.html) page has various examples using cursors. – Peter Wood Feb 29 '16 at 11:52
  • Thx for the help! However if you were refering to: from matplotlib.widgets import Cursor cursor = Cursor(ax, useblit=True, color='red', linewidth=2) This will draw a "Cursor" across the whole canvas – mathiasxx94 Feb 29 '16 at 12:11

0 Answers0