Inkscape.org
Creating New Extensions Accessing data-* attributes
  1. #1
    krishnarupa krishnarupa @krishnarupa

    Hi,

    I am writing an extension to help with book editing. In that matter the text for the book should be added and then split into several text boxes. The text value will be stored as data-split-text attribute.

    How should I access it using the python code?

    I believe I should use something like

    self.svg.<attribute>

    But I don´t seem to find the right syntax for that.

    Could someone point me to the right direction?

  2. #2
    inklinea inklinea @inklinea⛰️
    *

    for any attribute you can use getters and setters.

    my_object.set('attribute', value)

    my_object.get('attribute')

    If you use dotted notation my_object.my_attribute = 'hello'

    Then it will not be written to the svg document on extension return *unless* it is a dotted attribute inkscape recognises such as my_object.label