Search code examples
pythonblockdiag

How to write python code to use blockdiag package


I would like to display some data in a list by block diagram. I am trying to implement this Example but not able to write correct python code.

It will be great if someone can guide me. How can I execute blockdiag codes?


Solution

  • I found this discussion and it runs for me. Add your strings in the source.

    You can use blockdiag API like this::

    from blockdiag import parser, builder, drawer
    tree = parser.parse_string(source)
    diagram = builder.ScreenNodeBuilder.build(tree)
    draw = drawer.DiagramDraw('PNG', diagram, filename="foo.png")
    draw.draw()
    draw.save()
    

    This is another example using blockdiag API (works at http://interactive.blockdiag.com/ ) https://bitbucket.org/tk0miya/blockdiag_interactive_shell