开发者

How to serve static files using a webkit view in a python gtk application?

开发者 https://www.devze.com 2023-01-27 11:28 出处:网络
I am building a gtk desktop application. The main part of my views are HTML. So I make use of the Python implementation of Webkit. The problem is, that I cant include images, as Webkit does not allow

I am building a gtk desktop application. The main part of my views are HTML. So I make use of the Python implementation of Webkit. The problem is, that I cant include images, as Webkit does not allow to load images from local file system:

<img src="file://{{media_开发者_C百科url}}_theme/media/img/eft.png"/>

=> This will cause a "Not allowed to load local resource".

Is there a way to load static files like images or css-files locally?


You can use base64 to encode your images as texts that can be included in your html pages.


@Skami 18's answer seems like a good direction. Maybe then use a data URI to actually set the src attribute?

0

精彩评论

暂无评论...
验证码 换一张
取 消