[pygtk] R: Re: Strange Assertion

euro_ii at libero.it euro_ii at libero.it
Thu Aug 6 17:57:52 WST 2009


really i'm quit new on pygtk ..  

This is the class that i use to create the 
cursor...

class snapCursor:
    """
        This class provide a cursor object 
for each snap
    """
    def __init__(self,area):
        """
            Base 
Constructor
        """
        self.__pm = None
        self.__mask = None

        self.__Draw=area.window
        self.__style=gtk.Style()

    def Cursor
(self):
        """
            set The Cursor at the window
        """

        if(self.__pm==None or self.__mask==None):
            print("NoneType")

            test=self.__pm
            test1=self.__mask
            if
(isinstance(self.__pm,gtk.gdk.Pixmap)): print("isAPixmap")
            else:
print("isNotaPixmap")
            return None
                
        cur=gtk.
gdk.Cursor(self.__pm,self.__mask,gtk.gdk.color_parse("black"),gtk.gdk.
color_parse("white"),5,5)
        return cur
    def UpdatePixmap(self,
pixmapName):
        """
            Create a pixmap from a vector
        """

        try:
            self.__pm, self.__mask = gtk.gdk.
pixmap_create_from_xpm_d(
                self.__Draw,self.__style.bg[gtk.
STATE_NORMAL], pixmapName)
        except:
            print("Unable to create 
the pixmap")
    def EndPoint(self):
        """
            Define the 
endPoint Cursor
        """
        xpm = [
         "15 15 2 1",
         
".      c none",
         "@      c black",
         "..@@@@@@@@@@@..",

         ".@@@@@@@@@@@@@.",
         "@@@@@@@.@@@@@@@",
         "@@@@.......
@@@@",
         "@@...........@@",
         "@@...........@@",
         
"@@...........@@",
         "@@...........@@",
         "@@...........@@",

         "@@...........@@",
         "@@...........@@",
         "@@@@.......
@@@@",
         "@@@@@@@.@@@@@@@",
         ".@@@@@@@@@@@@@.",
         "..
@@@@@@@@@@@.."
        ]
        self.UpdatePixmap(xpm)
        return self.
Cursor()

>----Messaggio originale----
>Da: a.t.hofkamp at tue.nl
>Data: 
06/08/2009 11.12
>A: "euro_ii at libero.it"<euro_ii at libero.it>
>Cc: "pygtk at daa.com.
au"<pygtk at daa.com.au>
>Ogg: Re: [pygtk] Strange Assertion
>
>euro_ii at libero.it 
wrote:
>> I have an assertion when i invoke this method:
>> 
>> cur=gtk.gdk.
Cursor(self.__pm,
>> self.__mask,gtk.gdk.color_parse("black"),gtk.gdk.
color_parse("white"),5,5)
>> 
>> 
>> 
>> self.__pm
>> self.__mask
>> are two 
pixmap
>> 
>> assertion:
>> b"gdk_cursor_new_from_pixmap: 
>> assertion 
`GDK_PIXMAP_OBJECT (source)->depth == 1 && GDK_PIXMAP_OBJECT (mask)-
>>> depth 
== 1' failed"
>> 
>> I've looking on the net but without any result ...
>
>Wild 
guess: Is the number of bits per pixel for your pixmaps 1?
>
>
>Albert
>
>




More information about the pygtk mailing list