我试图通过嵌套字典迭代到一个带有示意图的集成电路中,但是值在最后的绘图中相互重叠,而不是在集成电路上创建新的条目。我想我可能还需要更多的迭代,但不太确定应该是什么。任何帮助都很感激!
下面是我的工作:
import schemdraw
import schemdraw.elements.intcircuits as eInt
dict1 = {'channel 1':
{'source_name': '1',
},
'channel 2':
{'source_name': '2',
}}
with schemdraw.Drawing(file='/Users/Desktop/circuitdrawing.png') as d:
for channel, info in dict1.items():
if channel != None:
for channel, info in dict1.items(): #might need another level of iteration here?
d += eInt.Ic(pins=[eInt.IcPin(name=(channel), pin=(info['source_name']), side='left')],
edgepadW = 2,
pinspacing = 1).label('console 1', 'top', fontsize=12)
else:
continue这是代码的输出:电路绘图
发布于 2022-07-09 21:32:21
通过在引脚信息中添加一个额外的插槽参数来解决这个问题,结果如下所示:
d += eInt.Ic(pins=[eInt.IcPin(name=(channel), pin=(info['source_name']), side='left'), slot='1/2'],
edgepadW = 2,
pinspacing = 1).label('console 1', 'top', fontsize=12)https://stackoverflow.com/questions/72779349
复制相似问题