import schemdraw
import schemdraw.elements as elm
# Create the drawing for the logic gates
d = schemdraw.Drawing()
# Input labels
d += (X:= elm.Dot().label('X', loc = 'left'))
d += (Y:= elm.Dot().label('Y', loc = 'left').at([0, -2]))
d += (W:= elm.Dot().label('W', loc = 'left').at([0, -4]))
# NOT gates
d += (NX:= elm.Not().at(X.end).anchor('out').label('NX'))
d += elm.Line().length(1.5).at(NX.out)
d += (NY:= elm.Not().at(Y.end).anchor('out').label('NY')).right()
d += elm.Line().length(1.5).at(NY.out)
d += (NW:= elm.Not().at(W.end).anchor('out').label('NW')).right()
d += elm.Line().length(1.5).at(NW.out)
# AND gates
d += (and1:= elm.And().at([7, 0]))
d += elm.Line().at([6, 2.5]).down(1.5).to(and1.in1)