|
|
| Author |
Message |
|
|
nadavvin Familiar Face
Joined: 06 Dec 2007 Posts: 19
|
Posted: Sun Nov 30, 2008 8:09 pm Post subject: How to get pixmap from a gtk.Image? |
|
|
| Code: (Plaintext) | 1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
>>> img = gtk.Image()
>>> img.get_pixmap()
(None, None)
>>> img.set_from_file('a.xpm')
>>> img.get_pixmap()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: image should be a GdkPixmap or empty
>>> img.get_pixmap()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: image should be a GdkPixmap or empty
|
get_image should return gtk.gdk.image but it gave the same error:
| Code: (Plaintext) | 1 2 3 4 5 6
|
img.get_image()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: image should be a GdkImage or empty
| |
|
| Back to top |
|
 |
tadeboro Never Seen the Sunlight
Joined: 23 Jul 2008 Posts: 2114 Location: Slovenia
|
Posted: Sun Nov 30, 2008 10:03 pm Post subject: |
|
|
Hi.
What does the | Code: (Python) | 1
| img.get_storage_type() | return? |
|
| Back to top |
|
 |
dreblen Never Seen the Sunlight
Joined: 14 Jun 2007 Posts: 936 Location: Falun, WI USA
|
|
| Back to top |
|
 |
nadavvin Familiar Face
Joined: 06 Dec 2007 Posts: 19
|
Posted: Mon Dec 01, 2008 2:25 pm Post subject: |
|
|
thanks (I didn't try yet)
Why is there method "get_pixmap" if we can use it only if the image is empty? |
|
| Back to top |
|
 |
dreblen Never Seen the Sunlight
Joined: 14 Jun 2007 Posts: 936 Location: Falun, WI USA
|
|
| Back to top |
|
 |
nadavvin Familiar Face
Joined: 06 Dec 2007 Posts: 19
|
Posted: Tue Dec 02, 2008 10:41 pm Post subject: |
|
|
I don't understand how to do it.
gtk.gdk.Drawable.draw_pixbuf is on;y render part of the pixbuf.
I guess it render to pixmap, but to where and how do I get it?
Why should I use get_pixmap() if it work only if the image create from pixmap? I can take the orginal pixmap |
|
| Back to top |
|
 |
dreblen Never Seen the Sunlight
Joined: 14 Jun 2007 Posts: 936 Location: Falun, WI USA
|
Posted: Wed Dec 03, 2008 12:23 am Post subject: |
|
|
| nadavvin wrote: | | gtk.gdk.Drawable.draw_pixbuf is only render part of the pixbuf. |
What do you mean by this? The src_[xy], dest_[xy], width and height parameters should control how much is rendered.
Can I ask why you need to use a GdkPixmap? Maybe there's an alternative that will work better for you... |
|
| Back to top |
|
 |
nadavvin Familiar Face
Joined: 06 Dec 2007 Posts: 19
|
Posted: Wed Dec 03, 2008 10:00 am Post subject: |
|
|
| dreblen wrote: |
Can I ask why you need to use a GdkPixmap? Maybe there's an alternative that will work better for you... |
I want to create customize windowfrom SVF image, therefore I need to get the mask of it, so I could pass it to the input_shape_combine_mask method. |
|
| Back to top |
|
 |
nadavvin Familiar Face
Joined: 06 Dec 2007 Posts: 19
|
Posted: Wed Dec 03, 2008 10:52 am Post subject: |
|
|
| tadeboro wrote: | Hi.
What does the | Code: (Python) | 1
| img.get_storage_type() | return? |
sorry, I didn't notice your response:
| Code: (Plaintext) | 1 2 3 4 5 6 7
|
>>> img = gtk.Image()
>>> img.set_from_file('1.svg')
>>> print img.get_storage_type()
<enum GTK_IMAGE_PIXBUF of type GtkImageType>
>>>
| |
|
| Back to top |
|
 |
dreblen Never Seen the Sunlight
Joined: 14 Jun 2007 Posts: 936 Location: Falun, WI USA
|
Posted: Wed Dec 03, 2008 6:36 pm Post subject: |
|
|
| dreblen wrote: | | nadavvin wrote: | | gtk.gdk.Drawable.draw_pixbuf is only render part of the pixbuf. |
What do you mean by this? The src_[xy], dest_[xy], width and height parameters should control how much is rendered. |
You never really answered this question. What exactly is happening right now (i.e. what isn't working)? |
|
| Back to top |
|
 |
nadavvin Familiar Face
Joined: 06 Dec 2007 Posts: 19
|
Posted: Wed Dec 03, 2008 7:07 pm Post subject: |
|
|
| dreblen wrote: | | dreblen wrote: | | nadavvin wrote: | | gtk.gdk.Drawable.draw_pixbuf is only render part of the pixbuf. |
What do you mean by this? The src_[xy], dest_[xy], width and height parameters should control how much is rendered. |
You never really answered this question. What exactly is happening right now (i.e. what isn't working)? |
I don't know how should I use it. draw_pixbuf draw a pixbuf from a part of other pixbuf. How do I use it to get the pixmap? |
|
| Back to top |
|
 |
nadavvin Familiar Face
Joined: 06 Dec 2007 Posts: 19
|
|
| Back to top |
|
 |
|