I would like to add multiline tool-tip for the nodes in the graph I am generating using pydot. Here is what I am doing:
node = pydot.Node('abc', style='filled', fillcolor='#CCFF00', fontsize=12)
txt = 'foo' + '\n' + 'test'
node.set_tooltip(txt)
The tool tip that I get to see appears as "foo\ntest'
I will appreciate any help.
Thanks Abhijit
It seems the new line character is supported for labels and names (Newline in node label in dot (graphviz) language), but tool tips are put directly into the resultant HTML, which does not see "\n" as a special character.
Using direct character codes is an alternative. (see Formatting & ASCII Control Codes)
node = pydot.Node('abc', style='filled', fillcolor='#CCFF00', fontsize=12)
# specify HTML Carriage Return (\r) and/or Line Feed (\n) characters directly
txt = 'foo' + ' ' + test'
node.set_tooltip(txt)
Or some simple pre-processing would allow you to keep the '\n' form:
node.set_tooltip(txt.replace('\n', ' '))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With