gdk

How to write contents of a Cairo Image surface into a Gdk Pixbuf?

泪湿孤枕 提交于 2019-12-11 07:29:03
问题 I have a canvas(Gdk Drawing Area), which I can draw into it using Cairo, but I need to save contents of my canvas into a buffer which in my case is a Gdk Pixbuf. I want to know if it's possible or not, if there is a better way I would like to know. thanks. 回答1: We do this in f-spot using a simple copy routine. Not the most elegant solution, but it works: http://git.gnome.org/browse/f-spot/tree/lib/libfspot/f-pixbuf-utils.c#n170 来源: https://stackoverflow.com/questions/4291994/how-to-write

Set window gravity in PyGObject?

北战南征 提交于 2019-12-11 05:05:43
问题 Every time I try to set the gravity of my application, it keeps throwing an error message like this: AttributeError: 'gi.repository.Gdk' object has no attribute 'GRAVITY_SOUTH_EAST' What is the correct method for setting the gravity of a GTK3 application with python? (Not pygtk, I'm using the newer PyGI libraries.) There isn't a documentation for PyGI AFAIK, and when I do help(Gdk.Gravity) in the python console it returns GDK_GRAVITY_SOUTH_EAST as an option. 来源: https://stackoverflow.com

Precision timing of GDK3/GTK3 window update

北慕城南 提交于 2019-12-11 03:21:50
问题 I have an application written in C using GTK (although the language is probably unimportant for this question). This application has a fullscreen gtk_window with a single gtk_drawing_area . For the drawing area, I have registered a tick callback via gtk_widget_add_tick_callback which just calls gtk_widget_queue_draw every tick. Inside the drawing area draw callback, I change the color of the entire window at regular intervals (e.g., from black to white at 1Hz). Say that in this call to the

Detecting when a GTK window is done moving/resizing by the user

£可爱£侵袭症+ 提交于 2019-12-10 15:46:18
问题 I want to detect when the user finished re-sizing or moving the GTK window. Basically an equivalent of WM_EXITSIZEMOVE in windows. I have looked at GTK detecting window resize from the user and am able to detect size/location changes using the configure-event; however because of how my other code is architect I want to know when the resizing is done. Almost like ValueChanged instead of ValueChanging event. I was thinking if i could find out is the mouse button is released or not and then try

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

Problems importing GDK

荒凉一梦 提交于 2019-12-06 08:48:58
I am trying to import GDK to my program however I continue to get an error No module named GDK Do you know how I can fix this? Since it was working before I already tried import gtk.GDK and import GDK . I have installed PyGTK and PyGDK is part of of it pyGTK. Try: import gtk.gdk (note: small letters) 来源: https://stackoverflow.com/questions/5923746/problems-importing-gdk

Groovy GDK equivalent of Apache Commons StringUtils.capitalize(str) or Perl's ucfirst(str)

孤者浪人 提交于 2019-12-04 04:13:01
Yes/no-question: Is there a Groovy GDK function to capitalize the first character of a string? I'm looking for a Groovy equivalent of Perl's ucfirst(..) or Apache Commons StringUtils.capitalize(str) (the latter capitalizes the first letter of all words in the input string). I'm currently coding this by hand using .. str = str[0].toUpperCase() + str[1 .. str.size() - 1] .. which works, but I assume there is a more Groovy way to do it. I'd imagine ucfirst(..) being a more common operation than say center(..) which is a standard method in the Groovy GDK (see http://groovy.codehaus.org/groovy-jdk

Python GTK Drag and Drop - Get URL

穿精又带淫゛_ 提交于 2019-12-03 14:53:19
问题 I'm creating a small app must be able to receive URLs. If the apps window is open, I should be able to drag a link from a browser and drop it into the app - and the app will save the URL to a database. I'm creating this in Python/GTk. But I am a bit confused about the drag and drop functionality in it. So, how do it? Some sample code to implement drag/drop(my app uses a bit of this code)... import pygtk pygtk.require('2.0') import gtk # function to print out the mime type of the drop item def

Sending an image to ftp server from gchar buffer (libcurl)

≯℡__Kan透↙ 提交于 2019-12-02 01:33:19
I'm developing a linux app programmed in C which processes gdk pixbuf images and then should send them to a remote server via ftp (libcurl). The images are saved into a gchar buffer with gdk_pixbuf_save_to_buffer . The problem is I don't know how to use the data in this buffer in conjunction with libcurl read callback function to send the image properly to the remote server. All my attempts so far have produced random bytes into the resulting file. There is an example of the libcurl read callback function which looks like this: static size_t read_callback(void *ptr, size_t size, size_t nmemb,

How do I get the gdk window for a gtk window in C?

纵饮孤独 提交于 2019-11-30 22:51:56
问题 I'm trying to set the cursor to a watch. The problem is that gdk_set_cursor() requires a gdk_window. How do I get the gdk_window of a gtk_window in C? I've seen examples for gtkmm and pygtk but I can't find the corresponding C function. 回答1: GdkWindow *gdk_window = gtk_widget_get_window(GTK_WIDGET(gtk_window)); or, pre GTK 2.14, but now disallowed: GdkWindow *gdk_window = gtk_window->window; 来源: https://stackoverflow.com/questions/10264625/how-do-i-get-the-gdk-window-for-a-gtk-window-in-c