]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/wxPython/src/misc.i
Some tweaks and updates
[wxWidgets.git] / utils / wxPython / src / misc.i
index faef0a7a9aff143867c29ebe9ab89aeea3b276c0..e82ac86b7849746b15bd4f16bd5d876d7c5d509e 100644 (file)
@@ -68,8 +68,24 @@ public:
     double y;
     wxRealPoint(double x=0.0, double y=0.0);
     ~wxRealPoint();
+
+    %addmethods {
+        void Set(double x, double y) {
+            self->x = x;
+            self->y = y;
+        }
+        PyObject* asTuple() {
+            PyObject* tup = PyTuple_New(2);
+            PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->x));
+            PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->y));
+            return tup;
+        }
+    }
+    %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
+    %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
 };
 
+
 class wxPoint {
 public:
     long x;