gdkpixbuf

GdkPixbuf.PixbufDestroyNotify - NotImplementedError - python gtk3

落爺英雄遲暮 提交于 2019-12-24 08:19:51
问题 I am trying to use GdkPixbuf.Pixbuf.new_from_data() as shown in gtk 2.x and I am passing 7 arguments. But it gives me an error that I need to pass 9 arguments. What I am doing now was working for gtk2.x . So I figured out the other 2 arguments that I need to pass. http://developer.gimp.org/api/2.0/gdk-pixbuf/gdk-pixbuf-creating.html http://developer.gimp.org/api/2.0/gdk-pixbuf/gdk-pixbuf-refcounting.html#GdkPixbufDestroyNotify One of the arguments is of type GdkPixbuf.PixbufDestroyNotify. I

Show icon or color in Gtk TreeView tree

吃可爱长大的小学妹 提交于 2019-12-19 09:44:29
问题 I am having difficulty loading a file or displaying a colour in one of the columns of a Gtk TreeView (Python binding of GTK3). An example taken from QGIS shows a icon in the first row and a blue circle in the second row. The colour is taken from the layer properties: My code looks like this but does not load the icon.png file in the same directory: #!/usr/bin/python3 from gi.repository import Gtk, Gdk, GdkPixbuf class MyWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self) self

Adding GtkButton to GtkListStore with text in GTK+

最后都变了- 提交于 2019-12-14 02:27:33
问题 I want a button with text on it for a GtkListStore . I read another answer using an image as a button, but I really need the title to be text. How can I do this? I'd be fine with a solution that renders text onto a GdkPixbuf as well. I've tried this: GType *types; types = g_new0 (GType, num_fields); for(int i=0; i<num_fields; i++) { types[i] = GTK_TYPE_BUTTON; } tree_store = gtk_list_store_newv(num_fields, types); tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(tree_store));

How to repair “error: gdk-pixbuf/gdk-pixdata.h: No such file or directory?”

三世轮回 提交于 2019-12-12 01:37:48
问题 I need to rotate a Pixbuf. The vala code contains using Gst, GLib, Posix, Sqlite, Gdk; public class RotateSaveImage { public void RotateSaveImage(string input, string output) { var img = new Pixbuf.from_file(input); var rotate_image = img.rotate_simple(PixbufRotation.CLOCKWISE); rotate_image.save(output, "jpeg"); } } The makefile contains test_VALAFLAGS = --vapidir=@VAPIDIR@ --pkg gstreamer-0.10 --pkg glib-2.0 --pkg gio-2.0 --pkg posix --thread --pkg gstreamer-app-0.10 --pkg sqlite3 --pkg gtk

Gdk pixbuf load image from memory

别说谁变了你拦得住时间么 提交于 2019-12-11 04:48:17
问题 Using GTK+ 3.6 I would like to display an image from a buffer in memory, not a file on disk. I have a const char *data with the image data, and I'm trying to create a GTK image from it. So far I have tried two approaches which I thought could work. Both use GdkPixbuf, and thus require the image data to be guchar* (unsigned char*) . With that requirement I have to cast the data: guchar *gudata = reinterpret_cast<guchar*>(const_cast<char*>(data)); I then tried the following: Writing the data

Get pixel value on Gdk::Pixbuf, Set pixel value with Gdk::Cairo

对着背影说爱祢 提交于 2019-12-10 09:26:33
问题 I'm using a Gdk::Pixbuf to display an image with Gdk::Cairo in C++ : virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { Glib::RefPtr<Gdk::Pixbuf> image = Gdk::Pixbuf::create_from_file(filename); Gdk::Cairo::set_source_pixbuf(cr, image, (width - image->get_width())/2, (height - image->get_height())/2); cr->paint(); /* other displaying stuffs */ } This image is in B&W and I need to bring out some pixels whose luminance is above a certain threshold. For that, I would like to color

Change the colour of pixels in a GdkPixbuf (GTK3)

我的梦境 提交于 2019-12-08 03:47:59
问题 I'm using Gtk.StatusIcon , and want to change the colour of some pixels; I have a working piece of code, this loads a 1x1 pixel PNG file with the colour I want to set, and then copies that to thhe icon Pixbuf. While this works, it has the obvious drawback of having to create a 1x1 pixel for every colour, so I can't use an arbitrary colour, only the predefined colours I created images for. How do I set a pixel to an arbitrary RGBA colour? The code I'm using now (simplified for demonstration

Drawing a custom GdkPixbuf using Gtk3 and cairo

怎甘沉沦 提交于 2019-12-06 10:32:54
问题 I would like to draw a custom shape in a cell of a Gtk.TreeView, using Python and GTK3. I have found out that cairo shall be used for this, but could not find any way to create a suitable Pixbuf object. I can load a file from the disk easily; but then I have no means to draw on it. It appears to be a common and easy task, still several hours searching for the solution through Internet did not help. How shall I implement the " Add a row with a custom-drawn image " block so that e.g. a small

save current window as image using gtk#

自古美人都是妖i 提交于 2019-11-28 10:31:43
问题 How can I save the current window as an image file such as a png? I know I can get a gdkWindow from current windows. I can even get an image. From this image struct I can even query each pixel. But from what I understand what I really need is to get a pixbuf. int width; int height; this.GetSize(width, height); this.GdkWindow.GetImage(0,0,width,height).? How do I get a pixbuf from a gtk window or a gdk window or a gdk image ? EDIT int width; int height; this.GetSize(out width, out height);

Gtk+3 Gdk Pixbuf.new_from_data gives “Segmentation fault (core dumped)” error 139

纵然是瞬间 提交于 2019-11-28 09:48:45
问题 In my application I have a GtkImage that must show the processed image from a choosed file. So, in the handlers section I have: import numpy as np from PIL import Image , ImageDraw from gi.repository import Gtk, GdkPixbuf . . . . . . def on_fitchooserdialog_response(self, menuitem, data=None): if data == 1: self.fitlist = self.fitchooser.get_filenames() # get data from 1st file: _, self.data = Getdata(self.fitlist[0]) # convert from Fits to 2D array: pngarray = Fit2png(self.data) # rescale: