I wrote:

> Is it possible to set the dash list of a GC? I cannot find any way to
> do it...    -- Ture

Oh well. Here's what I used as a stopgap so I could get on with hacking:

--- gtkmodule.c.~1~     Mon Dec 21 11:20:07 1998
+++ gtkmodule.c Tue Feb 23 23:49:08 1999
@@ -1356,7 +1385,39 @@ PyGdkGC_SetAttr(PyGdkGC_Object *self, ch
     PyErr_SetString(PyExc_TypeError, "can't delete attributes");
     return -1;
   }
-  if (PyInt_Check(value)) {
+  if (!strcmp(key, "dashes")) {   
+      PyObject *offset, *dash_list;
+      int coffset;
+      char *cdash_list;
+      int k;
+      if (!PyTuple_Check(value) || PyTuple_Size(value) != 2) {
+          PyErr_SetString(PyExc_TypeError, "set_dashes requires a tuple/2");
+          return -1;
+      }
+      offset = PyTuple_GetItem(value, 0);
+      dash_list = PyTuple_GetItem(value, 1);
+      if (!PyInt_Check(offset) || !PyList_Check(dash_list)) {
+          PyErr_SetString(PyExc_TypeError, 
+                          "bad type for offset or dash_list");
+          return -1;
+      }
+      coffset = (int)PyInt_AsLong(offset);
+      cdash_list = malloc(PyList_Size(dash_list));
+      for (k = 0; k < PyList_Size(dash_list); k++) {
+          PyObject *item;
+          item = PyList_GetItem(dash_list, k);
+          if (!PyInt_Check(item)) {
+              PyErr_SetString(PyExc_TypeError,
+                              "dash list items must be integers");
+              free(cdash_list);
+          }
+          cdash_list[k] = (char)PyInt_AsLong(item);
+      }
+      gdk_gc_set_dashes(gc, coffset, cdash_list, PyList_Size(dash_list));
+      free(cdash_list);
+      return 0;
+  }
+  else if (PyInt_Check(value)) {
     int i = PyInt_AsLong(value);
     GdkGCValues v;
     gdk_gc_get_values(gc, &v);
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]

Reply via email to