There are variety of cursors available using the wx.StockCursor() in wxPython:
# a look at cursors and wx.StockCursor()
import wx
class MyFrame(wx.Frame):
"""create a color frame, inherits from wx.Frame"""
def __init__(self, parent):
wx.Frame.__init__(self, parent, wx.ID_ANY, "Left click the mouse",
size=(500, 300))
self.SetBackgroundColour('yellow')
self.count = 0
# just to show you how to set it, actually the default cursor
self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
# bind mouse left click event
self.Bind(wx.EVT_LEFT_DOWN, self.onLeftDown)
def onLeftDown(self, event):
"""left mouse button is pressed"""
# get (x, y) position tuple
pt = event.GetPosition()
# put cursor globals in as strings so the name can be shown
cursors = ['wx.CURSOR_SPRAYCAN', 'wx.CURSOR_NO_ENTRY', 'wx.CURSOR_BULLSEYE',
'wx.CURSOR_CROSS', 'wx.CURSOR_HAND', 'wx.CURSOR_IBEAM',
'wx.CURSOR_MAGNIFIER', 'wx.CURSOR_PENCIL', 'wx.CURSOR_RIGHT_ARROW',
'wx.CURSOR_QUESTION_ARROW', 'wx.CURSOR_WAIT', 'wx.CURSOR_ARROWWAIT',
'wx.CURSOR_PAINT_BRUSH', 'wx.CURSOR_SIZING']
s = "cursor = %s at point %s" % (cursors[self.count], str(pt))
self.SetTitle(s)
# use eval() to get the integer value back
int_val = eval(cursors[self.count])
self.SetCursor(wx.StockCursor(int_val))
self.count += 1
if self.count >= len(cursors):
self.count = 0
app = wx.App(0)
MyFrame(None).Show()
app.MainLoop()