PyQt WebKit CSS background image not showing
- by Enfors
I'm making a Twitter client with PyQt, which uses WebKit to draw the tweet list. Now I'm trying to use CSS to set a background image in the WebKit widget - but the image won't show up. This is the relevant part of the CSS:
body
{
background-image: url("gradient2.jpg");
}
The file name is correctly spelled, and it is located in the same directory as the Python program, which is also where I start the program from (so the image file should be in PWD).
To check if WebKit somehow looks for the image in the wrong directory anyway, I ran my program through strace, which creates a log of all system calls made by the program. And surprisingly, the name of the image does not appear in the log - so it seems as if WebKit doesn't even try to find it.
To verify that my CSS is used at all by WebKit, I tried changing it to a solid background color instead of an image:
body
{
background: #CCFFCC;
}
And that works. So I know that the CSS is used, that's not the problem.
Could it be that WebKit refuses to use "ordinary" files in the filesystem, and that I somehow have to create some sort of "resource" file containing my image in Qt Designer?