I’m currently writing custom widgets in pure python by overriding the do_snapshot function.
Thats works pretty well.
But now I would like to be able to style my custom widget using CSS but I have no idea how I would access the information. (like color, background-image, marings/padding, …)
I try loading the CSS with a CssProvider and use the
get_style_property
method as describte in the documenation but unfortunately that function is not exposed in python.
Only widgets can be styled with CSS, and that happens automatically inside GTK.
Custom rendering is, by definition, custom and cannot be styled with CSS.
You should replace your custom rendering with real widgets: it was a lot more expensive in older versions of GTK, but that’s not true any more in GTK4.