本文整理汇总了Python中connector.Connector.addWire方法的典型用法代码示例。如果您正苦于以下问题:Python Connector.addWire方法的具体用法?Python Connector.addWire怎么用?Python Connector.addWire使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类connector.Connector
的用法示例。
在下文中一共展示了Connector.addWire方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Or
# 需要导入模块: from connector import Connector [as 别名]
# 或者: from connector.Connector import addWire [as 别名]
class Or (Circuit):
def setupGraphics(self):
n1 = Nand2(self, "N1", self.scale1((80, 30))) # Nand Gate
i1 = Inv(self, "I1") # Inverter for n1.A
i2 = Inv(self, "I2") # Inverter for n1.B
# external connectorself. Same depth as xor circuit
i1.align(i1.B, n1.A, -40, -20) # inverter precedes Nand
i2.align(i2.B, n1.B, -40, 20) # inverter precedes Nand
self.A = Connector(self, "A", ((i1.A.x(-20), i1.A.y())))
self.B = Connector(self, "B", ((i2.A.x(-20), i2.B.y())))
self.C = Connector(self, "C", ((n1.C.x( 20), n1.C.y())))
self.output = self.C # who is output
self.gates = (i1, i2, n1)
self.i1, self.i2, self.n1 = (i1, i2, n1)
i1.B.addWire(n1.A)
i2.B.addWire(n1.B)
self.A.addWire(i1.A)
self.B.addWire(i2.A)
n1.C.addWire(self.C)
if self.encapsulated(): # if encapsulated re-work externals
self.A.pos, self.B.pos, self.C.pos = self.scaleM(( 0, 5),
( 0, 35),
(20, 20))