--- Begin Message ---
I managed to do it :-)
Thanks for all.
Here is my code:
import gtk
import string
def create_pixbuf():
b = 150*3*150*['\0']
for i in range(150):
for j in range(150):
b[3*150*i+3*j] = chr(255-i)
b[3*150*i+3*j+1] = chr(100+j/2)
b[3*150*i+j*3+2] = chr(255-j)
buf = string.join(b,'')
pb = gtk.gdk.pixbuf_new_from_data(buf, gtk.gdk.COLORSPACE_RGB,
gtk.FALSE, 8, 150, 150, 3*150)
return pb
buf = create_pixbuf()
i = gtk.Image()
i.set_from_pixbuf(buf)
w = gtk.Window(gtk.WINDOW_TOPLEVEL)
w.connect('destroy', lambda w: gtk.main_quit())
w.add(i)
i.show()
w.show()
gtk.main()
On 6/15/05, C�sar Leonardo Blum Silveira <[EMAIL PROTECTED]> wrote:
> Yep! Thanks :-)
>
> But still I need some help.
> 1) how do I set my values to 8 bit? In C I used guint8
> 2) What is bits per sample?
>
> Thanks again
>
>
>
>
> On 6/15/05, Rafael Villar Burke <[EMAIL PROTECTED]> wrote:
> > C�sar Leonardo Blum Silveira wrote:
> >
> > >Hello all,
> > >
> > >I think this is my first post to the list, but I've been reading it
> > >for a while now.
> > >When using GTK in C, there is a data type called GdkPixdata.
> > >
> >
> > I think you're looking for something like this:
> > http://pygtk.org/pygtk2reference/class-gdkpixbuf.html#function-gdk--pixbuf-new-from-data
> >
> > Take care,
> >
> > Pachi
> >
> > P.S.: If you get to write a beautiful example it would be nice to have
> > it posted to the mailing list :)
> >
>
>
> --
>
> C�sar Leonardo Blum Silveira
> Undergrad Student - Computer Science - Unisinos
> Centro de Simula��o de Humanos Virtuais
> MSN: cesarbs490 _at_ msn _dot_ com
> ICQ: 170861826
>
--
C�sar Leonardo Blum Silveira
Undergrad Student - Computer Science - Unisinos
Centro de Simula��o de Humanos Virtuais
MSN: cesarbs490 _at_ msn _dot_ com
ICQ: 170861826
--- End Message ---
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/