]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/Cursor.py
Allow clearing the history, and saving the history on demand
[wxWidgets.git] / wxPython / demo / Cursor.py
index 301a84d99b09e5fb96debdeda4357ecb369d926b..ddc520b5717ae93691fd96cbdc9c2380d2f728f5 100644 (file)
@@ -51,27 +51,27 @@ class TestPanel(wx.Panel):
         choices.sort()
 
         # create the controls
-        self.ch = wx.Choice(self, -1, choices=choices)
-        self.ch.SetStringSelection("wx.CURSOR_DEFAULT")
+        self.cb = wx.ComboBox(self, -1, "wx.CURSOR_DEFAULT", choices=choices,
+                              style=wx.CB_READONLY)
         self.tx = wx.StaticText(self, -1,                                
              "This sample allows you to see all the stock cursors \n"
              "available to wxPython.  Simply select a name from the \n"
-             "wx.Choice and then move the mouse into the dineo below \n"
-             "to see the cursor.  NOTE: not all stock cursors have a \n"
-             "specific representaion on all platforms.")
+             "wx.Choice and then move the mouse into the window \n"
+             "below to see the cursor.  NOTE: not all stock cursors \n"
+             "have a specific representaion on all platforms.")
         
         self.win = wx.Window(self, -1, size=(200,200), style=wx.SIMPLE_BORDER)
         self.win.SetBackgroundColour("white")
 
         # bind an event or two
-        self.Bind(wx.EVT_CHOICE, self.OnChooseCursor, self.ch)
+        self.Bind(wx.EVT_COMBOBOX, self.OnChooseCursor, self.cb)
         self.win.Bind(wx.EVT_LEFT_DOWN, self.OnDrawDot)
         
 
         # Setup the layout
         gbs = wx.GridBagSizer()
-        gbs.Add(self.ch, (2,2))
-        gbs.Add(self.tx, (2,4))
+        gbs.Add(self.cb, (2,1))
+        gbs.Add(self.tx, (2,3))
         gbs.Add(self.win, (5,0), (1, 6), wx.ALIGN_CENTER)
         self.SetSizer(gbs)
 
@@ -79,19 +79,18 @@ class TestPanel(wx.Panel):
     def OnChooseCursor(self, evt):
         # clear the dots
         self.win.Refresh()
-        
-        choice = self.ch.GetStringSelection()
+
+        choice = evt.GetString() #self.cb.GetStringSelection()
         self.log.write("Selecting the %s cursor\n" % choice)
 
         cnum = cursors[choice]
         
         if cnum == CUSTOMID:
-            image = images.getBlom12Image()
-            image.SetMaskColour(255, 255, 255)
+            image = images.getPointyImage()
 
             # since this image didn't come from a .cur file, tell it where the hotspot is
-            image.SetOptionInt(wx.IMAGE_OPTION_CUR_HOTSPOT_X, 0)
-            image.SetOptionInt(wx.IMAGE_OPTION_CUR_HOTSPOT_Y, 22)
+            image.SetOptionInt(wx.IMAGE_OPTION_CUR_HOTSPOT_X, 1)
+            image.SetOptionInt(wx.IMAGE_OPTION_CUR_HOTSPOT_Y, 1)
 
             # make the image into a cursor
             cursor = wx.CursorFromImage(image)
@@ -109,7 +108,8 @@ class TestPanel(wx.Panel):
         dc = wx.ClientDC(self.win)
         dc.SetPen(wx.Pen("RED"))
         dc.SetBrush(wx.Brush("RED"))
-        dc.DrawCircle(evt.GetPosition(), 4)
+        pos = evt.GetPosition()
+        dc.DrawCircle(pos.x, pos.y, 4)
         
 
 #----------------------------------------------------------------------
@@ -135,5 +135,5 @@ This demo shows the stock mouse cursors that are available to wxPython.
 if __name__ == '__main__':
     import sys,os
     import run
-    run.main(['', os.path.basename(sys.argv[0])])
+    run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])