Have a Gtk.Box() and need add specific css only to widget. Have a dinamic class as Box called CustomBox and have functions like setBackgroundColor(self, strRgbColor), need in each function modify the css only for that widget.
Example:
box1 = CustomBox()
box1.setPadding(10,10,0,0)
box2 = CustomBox()
box2.setBackgroundColor('#ff0000')
Need each widget with specific css.
Y have:
self.id = 'box_' + str(id(self))
box = Gtk.Box()
box.set_name(self.id)
# ...
css_provider = Gtk.CssProvider()
css_provider.load_from_data(('#' + self.id + '{ border: 1px solid red; }').encode())
context = Gtk.StyleContext()
# ... ??
Where self.id is the unique id (with id(self)), but how set the css_provider to box?