cairo

Cairo context and persistence?

不想你离开。 提交于 2020-02-02 06:32:43
问题 I am just getting started using pycairo, and I ran into the following interesting error. The program I write creates a simple gtk window, draws a rectangle on it, and then has a callback to draw a random line on any kind of keyboard input. However, it seems that with each keyboard input, I have to create a new context, or I get an error at the moment the program receives first keyboard input (specifically, on the .stroke() line). Error is as follows, if it matters. 'BadDrawable (invalid

Cairo context and persistence?

扶醉桌前 提交于 2020-02-02 06:31:32
问题 I am just getting started using pycairo, and I ran into the following interesting error. The program I write creates a simple gtk window, draws a rectangle on it, and then has a callback to draw a random line on any kind of keyboard input. However, it seems that with each keyboard input, I have to create a new context, or I get an error at the moment the program receives first keyboard input (specifically, on the .stroke() line). Error is as follows, if it matters. 'BadDrawable (invalid

Trying to build pycairo on mac 10.8

巧了我就是萌 提交于 2020-01-24 21:34:05
问题 I have two Python installations. The one that came with the OS, and one I downloaded and installed manually, both are 2.7. The one I downloaded manually is my default Python. which python returns /Library/Frameworks/Python.framework/Versions/2.7/bin/python I have already installed Cairo, again, manually. I then downloaded py2cairo, went to the directory and ran ./waf configure , which then returned... ./set_options ./init ./configure Checking for program gcc or cc : /usr/bin/gcc Checking for

Gtk theme in GTK# (Windows)

為{幸葍}努か 提交于 2020-01-21 11:28:12
问题 I'm trying to change the theme in GTK# ( OS: Windows, IDE: Xamarin ). But I get next issues: I was able to find only one theme which correctly render, it is "Orta". All was well, except for lags and freezes . Here is my code: string Resource_File = "Orta\\gtk-2.0\\gtkrc"; Application.Init (); Gtk.Rc.AddDefaultFile (Resource_File); Gtk.Rc.Parse (Resource_File); MainWindow win = new MainWindow (); win.Show (); Application.Run (); When I changing the size of the Paned or clicking on button I get

Creating Multiple PDFs with Python Cairo

拜拜、爱过 提交于 2020-01-16 02:12:10
问题 Alright, I've been coming here for help for years, and now I finally have a question that isn't covered. I'm trying to take a .txt file from my AS/400 print queue(no problems here), and output each "page" as a PDF(the next step is merging them into one file). Ive got the formatting part down, and I can create a single page document correctly with no issues. I've taken the code that generates the single pages, and expanded it to handle files that contain multiple pages when "printed" with

unable to install Cairo package under linux

☆樱花仙子☆ 提交于 2020-01-15 05:28:07
问题 I locally download the package and atempt to install it but I get this error: R CMD INSTALL -l /usr/local/lib64/R/library Cairo_1.5-1.tar.gz I get his error: checking for PNG support in Cairo... yes checking for ATS font support in Cairo... no configure: CAIRO_LIBS=-L/usr/local/lib -lcairo checking for library containing deflate... no checking whether Cairo programs can be compiled... configure: error: Cannot compile a simple Cairo program. See config.log for details. ERROR: configuration

Python SVG converter creates empty file

早过忘川 提交于 2020-01-14 08:44:08
问题 I have some code below that is supposed to convert a SVG image to a PNG. It runs without errors but creates a PNG file that is blank instead of one with the same image as the original SVG. I did find that it is not an error with cairo but more one relating to rsvg, which I got here. import cairo import rsvg img = cairo.ImageSurface(cairo.FORMAT_ARGB32, 640,480) ctx = cairo.Context(img) handle= rsvghandler.Handle('example.svg') handle.render_cairo(ctx) img.write_to_png("svg.png") I am using

Cairo pdf doesn't work properly due to “out of memory” in R

有些话、适合烂在心里 提交于 2020-01-13 07:27:07
问题 I'm trying to produce a pdf document with a graphic created with some R functions, like plot() or ggplot() . Since I use a Windows machine, I need to call cairo_pdf to change the font-family of the plot and to embed another fonts I specify. I have successfully knit the pdf document with plots created with cairo on my Windows 10. However, when I try to knit the document on my Windows 8.1, I always receive the following error message: Quitting from lines 22-23 (test.Rmd) Error in (function

Drawing in PyGobject (python3)

前提是你 提交于 2020-01-10 04:10:48
问题 I'm trying to write simple graphic editor using PyGObject and python 3. I need to draw lines with different color and width using mouse. I found many examples like this but nothing more complex. How do I save drawn image between 'draw' events? Is there incremental way of drawing or do I have to redraw pane on each 'draw' event? I found out that I can save path but how can I save width and colors of drawn lines? Is there way create image outside 'draw' callback and only apply (draw) it inside

Fit line to width with Pango and Cairo (Pycairo)

梦想的初衷 提交于 2020-01-03 14:15:14
问题 I've several lines of text and I'd like each to fit in width (scaling the font size) to the width of the Context. Is there a way of doing this? I'm using pangocairo and python for this. 回答1: I wish to have time for a working solution, but you can start with something like: import cairo import pango import pangocairo import sys W = 500 H = int(1.4 * W) surf = cairo.ImageSurface(cairo.FORMAT_ARGB32, W, H) context = cairo.Context(surf) #draw a background rectangle: context.rectangle(0, 0, W, H)