首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将嵌套字典迭代到Schemdraw电路中

如何将嵌套字典迭代到Schemdraw电路中
EN

Stack Overflow用户
提问于 2022-06-27 23:47:08
回答 1查看 31关注 0票数 0

我试图通过嵌套字典迭代到一个带有示意图的集成电路中,但是值在最后的绘图中相互重叠,而不是在集成电路上创建新的条目。我想我可能还需要更多的迭代,但不太确定应该是什么。任何帮助都很感激!

下面是我的工作:

代码语言:javascript
复制
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

这是代码的输出:电路绘图

EN

回答 1

Stack Overflow用户

发布于 2022-07-09 21:32:21

通过在引脚信息中添加一个额外的插槽参数来解决这个问题,结果如下所示:

代码语言:javascript
复制
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)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72779349

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档