What line is the script stopping at...from the traceback? Does it make it to
the canvas.root().add() call?
Jeff
Travis Oliphant wrote:
>
> I have just started using the gnome-python system and am having trouble
> displaying an image on the Gnome Canvas.
>
> I'm using gnome-python-1.0.3
>
> This is what I'm doing. Am I doing something wrong?
>
> import gtk
> import GdkImlib
> import gnome.ui
>
> import MLab # some numeric functions
>
> arr = MLab.eye(50) # an identity matrix
>
> # Make the identity matrix into an RGB image with a diagonal of
> # RGB=255,255,255
> arr = (arr[...,MLab.NewAxis]*MLab.ones((1,1,3))*255).astype('b')
>
> # create the image from a string of data
> im = GdkImlib.create_image_from_data(arr.tostring(),None,50,50)
>
> # Construct a window
> win = gtk.GtkWindow()
> win.connect('destroy',gtk.mainquit)
> win.show()
>
> # Construct a canvas
> canvas = gnome.ui.GnomeCanvas()
> canvas.set_usize(200,200)
>
> # Add canvas to the window
> win.add(canvas)
> canvas.show()
>
> # Add an ellipse to the window (this works)
> el=canvas.root().add('ellipse',x1=30,x2=60,y1=40,y2=100,fill_color='blue')
>
> # Add an image to the window (this doesn't)
> theim = canvas.root().add('image',x=10,y=20,image=im._im)
>
> gtk.mainloop()
>
> The result of this script:
>
> GnomeUI-ERROR **: file gnome-canvas-image.c: line 461 (recalc_if_needed):
> assertion failed: (image->pixmap != NULL)
> aborting...
> Aborted (core dumped)
>
> In the source-code this assertion takes place right after the command
>
> image->pixmap = gdk_imlib_move_image (image->im);
>
> which I suppose renders the RGB image in a pixmap for display. Apparently
> this call is not working. But it seems like I'm passing the right type
> (im._im is a PyGdkImageObject in Python).
>
> Any help is appreciated..
>
> Thanks,
>
> Travis Oliphant
> [EMAIL PROTECTED]
>
> To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]
--
J.W. Bizzaro mailto:[EMAIL PROTECTED]
Boston College Chemistry http://www.uml.edu/Dept/Chem/Bizzaro/
--
To unsubscribe: echo "unsubscribe" | mail [EMAIL PROTECTED]