Hi,
I try to create python extension and I'd like to know if ther's an easy way to generate unique id ?
Some func I would give a string "my_cool_filter" and that will return "my_cool_filter" if no such id exists and "my_cool_filter_random_stuff" otherwise.
I could go with timestamp + some rand (or browsing the whole svg for id) but if someone already got something like that please let me know.
Thank you.
Python generate unique id
Re: Python generate unique id
Here's a link: http://stackoverflow.com/questions/5348 ... -in-python
Although I've simply left the id off of elements that I've created through extensions in the past; Inkscape will automatically add it's own. I typically use labels (instead of ids) as internal keys within my extensions.
Although I've simply left the id off of elements that I've created through extensions in the past; Inkscape will automatically add it's own. I typically use labels (instead of ids) as internal keys within my extensions.
Re: Python generate unique id
Thank you.
I needed ID coz I add filters in the defs section and link selected objects to those filters.
import uuid
...
random_string = str(uuid.uuid4())
I needed ID coz I add filters in the defs section and link selected objects to those filters.
import uuid
...
random_string = str(uuid.uuid4())