Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Block diagram library
#1
I need a library that can generate an image with the following diagram type:
[Image: Immagine.png]
Each block has
- a name
- some input (labeled) pins
- some output (labeled) pins
The connections are between output pin of one block and input pin of another block.
The library should also automatically computes the position of blocks.
Reply
#2
I'm not sure if you will be able to use this for your application, but it's worth looking into
https://pypi.org/project/graphviz/
github: https://github.com/xflr6/graphviz

The reason I think it might work is that I found another application built on top of graphviz, which generates a UML model, closer to what you're trying to do. That pachage is located here: https://pypi.org/project/pg-diagram/
Reply
#3
Thank you for your answer.
Graphviz seems to be similar to networkx library, but I think it generates better diagrams. There is the concept of ports that can be useful for me. The problem is that also in graphviz the connection (the edge) has a single label. In the pg_diagram the label of the ports seems to be inside of the block itself. Probably is the only possibile solution if I want to use existing libraries.
Reply
#4
I haven't actually played with Graphviz, but I have an application that I'm working on now where it might fit nicely. I'll play around with it for a few days and get back with whatever I've garnered.
Reply
#5
For 2 labels look at https://stackoverflow.com/q/20149082/4046632
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#6
(Nov-13-2020, 03:30 AM)buran Wrote: For 2 labels look at https://stackoverflow.com/q/20149082/4046632
Yes, headlabel and taillabel are the attributes I was looking for Thumbs Up
Unfortunately they overlap in the automatic visualization. Now I have to search some attribute for avoiding this.
Reply
#7
Also have a look at the blockdiag library. Currently untested for me but it has been in my bookmarks for some time.
Reply
#8
(Nov-13-2020, 10:18 AM)Gribouillis Wrote: Also have a look at the blockdiag library. Currently untested for me but it has been in my bookmarks for some time.
Yes I've already checked that library but when I tried it I was not able to do multiple connection between 2 nodes and set labels on the input/output pins.
For the overlapping of head/tail labels problem maybe I found a (dirty) solution. Since here is said that there is no control of that types of label, I decided to create an empy edge label with a number of space equal to len(headlabel)+len(taillabel)+5. It seems to work.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Better python library to create ER Diagram by using pandas data frames as tables klllmmm 0 1,102 Oct-19-2023, 01:01 PM
Last Post: klllmmm
  Generating classes diagram from source code Pavel_47 3 5,614 Oct-01-2021, 03:31 AM
Last Post: Lou
  Plotting “simple” diagram with gridlines at specified intervals schniefen 1 2,409 Dec-03-2020, 05:54 PM
Last Post: schniefen
  Python Architecture in Bock diagram hshivaraj 3 3,455 Jan-08-2018, 05:52 PM
Last Post: wavic
  PyInstaller, how to create library folder instead of library.zip file ? harun2525 2 4,790 May-06-2017, 11:29 AM
Last Post: harun2525

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020