On 05-08-17 15:23, Johnson Jones wrote:
On Saturday, 5 August 2017 at 12:51:13 UTC, Mike Wey wrote:
On 03-08-17 21:56, Johnson Jones wrote:
If I do something like

import gdkpixbuf.Pixbuf;

There are two issues here, you need to properly escape the slash: "C:\\\\a.jpg".

And a.jpg is not a resource file, so you would use the Pixbuf constuctor to load an image file.

Pixbuf p = new Pixbuf(r"C:\\a.jpg");

Thanks. Why do I need 4 slashes? Is that standard with gtk because strings are interpreted twice or something? Seemed to work though.

Nothing specific to GTK but in D and other programing languages the \ is used as an escape character, so you can use special characters in your sting like `\n` for a newline. But this means you will need to use \\ to get an literal back slash.


You can also use an wysiwyg string by using `r"` at the start so what you type is what you get.


Mike Wey

Reply via email to