5 #----------------------------------------------------------------------
10 "wx.CURSOR_ARROW" : wx
.CURSOR_ARROW
,
11 "wx.CURSOR_RIGHT_ARROW" : wx
.CURSOR_RIGHT_ARROW
,
12 "wx.CURSOR_BULLSEYE" : wx
.CURSOR_BULLSEYE
,
13 "wx.CURSOR_CHAR" : wx
.CURSOR_CHAR
,
14 "wx.CURSOR_CROSS" : wx
.CURSOR_CROSS
,
15 "wx.CURSOR_HAND" : wx
.CURSOR_HAND
,
16 "wx.CURSOR_IBEAM" : wx
.CURSOR_IBEAM
,
17 "wx.CURSOR_LEFT_BUTTON" : wx
.CURSOR_LEFT_BUTTON
,
18 "wx.CURSOR_MAGNIFIER" : wx
.CURSOR_MAGNIFIER
,
19 "wx.CURSOR_MIDDLE_BUTTON" : wx
.CURSOR_MIDDLE_BUTTON
,
20 "wx.CURSOR_NO_ENTRY" : wx
.CURSOR_NO_ENTRY
,
21 "wx.CURSOR_PAINT_BRUSH" : wx
.CURSOR_PAINT_BRUSH
,
22 "wx.CURSOR_PENCIL" : wx
.CURSOR_PENCIL
,
23 "wx.CURSOR_POINT_LEFT" : wx
.CURSOR_POINT_LEFT
,
24 "wx.CURSOR_POINT_RIGHT" : wx
.CURSOR_POINT_RIGHT
,
25 "wx.CURSOR_QUESTION_ARROW" : wx
.CURSOR_QUESTION_ARROW
,
26 "wx.CURSOR_RIGHT_BUTTON" : wx
.CURSOR_RIGHT_BUTTON
,
27 "wx.CURSOR_SIZENESW" : wx
.CURSOR_SIZENESW
,
28 "wx.CURSOR_SIZENS" : wx
.CURSOR_SIZENS
,
29 "wx.CURSOR_SIZENWSE" : wx
.CURSOR_SIZENWSE
,
30 "wx.CURSOR_SIZEWE" : wx
.CURSOR_SIZEWE
,
31 "wx.CURSOR_SIZING" : wx
.CURSOR_SIZING
,
32 "wx.CURSOR_SPRAYCAN" : wx
.CURSOR_SPRAYCAN
,
33 "wx.CURSOR_WAIT" : wx
.CURSOR_WAIT
,
34 "wx.CURSOR_WATCH" : wx
.CURSOR_WATCH
,
35 "wx.CURSOR_BLANK" : wx
.CURSOR_BLANK
,
36 "wx.CURSOR_DEFAULT" : wx
.CURSOR_DEFAULT
,
37 "wx.CURSOR_COPY_ARROW" : wx
.CURSOR_COPY_ARROW
,
38 "wx.CURSOR_ARROWWAIT" : wx
.CURSOR_ARROWWAIT
,
40 "zz [custom cursor]" : CUSTOMID
,
44 class TestPanel(wx
.Panel
):
45 def __init__(self
, parent
, log
):
47 wx
.Panel
.__init
__(self
, parent
, -1)
49 # create a list of choices from the dictionary above
50 choices
= cursors
.keys()
54 self
.cb
= wx
.ComboBox(self
, -1, "wx.CURSOR_DEFAULT", choices
=choices
,
56 self
.tx
= wx
.StaticText(self
, -1,
57 "This sample allows you to see all the stock cursors \n"
58 "available to wxPython. Simply select a name from the \n"
59 "wx.Choice and then move the mouse into the window \n"
60 "below to see the cursor. NOTE: not all stock cursors \n"
61 "have a specific representaion on all platforms.")
63 self
.win
= wx
.Window(self
, -1, size
=(200,200), style
=wx
.SIMPLE_BORDER
)
64 self
.win
.SetBackgroundColour("white")
66 # bind an event or two
67 self
.Bind(wx
.EVT_COMBOBOX
, self
.OnChooseCursor
, self
.cb
)
68 self
.win
.Bind(wx
.EVT_LEFT_DOWN
, self
.OnDrawDot
)
72 gbs
= wx
.GridBagSizer()
73 gbs
.Add(self
.cb
, (2,1))
74 gbs
.Add(self
.tx
, (2,3))
75 gbs
.Add(self
.win
, (5,0), (1, 6), wx
.ALIGN_CENTER
)
79 def OnChooseCursor(self
, evt
):
83 choice
= self
.cb
.GetStringSelection()
84 self
.log
.write("Selecting the %s cursor\n" % choice
)
86 cnum
= cursors
[choice
]
89 image
= images
.getBlom12Image()
90 image
.SetMaskColour(255, 255, 255)
92 # since this image didn't come from a .cur file, tell it where the hotspot is
93 image
.SetOptionInt(wx
.IMAGE_OPTION_CUR_HOTSPOT_X
, 0)
94 image
.SetOptionInt(wx
.IMAGE_OPTION_CUR_HOTSPOT_Y
, 22)
96 # make the image into a cursor
97 cursor
= wx
.CursorFromImage(image
)
100 # create one of the stock (built-in) cursors
101 cursor
= wx
.StockCursor(cnum
)
103 # set the cursor for the window
104 self
.win
.SetCursor(cursor
)
107 def OnDrawDot(self
, evt
):
108 # Draw a dot so the user can see where the hotspot is
109 dc
= wx
.ClientDC(self
.win
)
110 dc
.SetPen(wx
.Pen("RED"))
111 dc
.SetBrush(wx
.Brush("RED"))
112 pos
= evt
.GetPosition()
113 dc
.DrawCircle(pos
.x
, pos
.y
, 4)
116 #----------------------------------------------------------------------
118 def runTest(frame
, nb
, log
):
119 win
= TestPanel(nb
, log
)
122 #----------------------------------------------------------------------
126 overview
= """<html><body>
127 <h2><center>wx.Cursor</center></h2>
129 This demo shows the stock mouse cursors that are available to wxPython.
136 if __name__
== '__main__':
139 run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])