cdelker / schemdraw

MIT License
103 stars 20 forks source link

The last element is not shown when d.draw() within the context #31

Closed pozitron57 closed 5 months ago

pozitron57 commented 6 months ago

print(schemdraw.__version__) 0.19a0

Not sure if this is intended behavior, but I noticed that the last element is not shown using d.save() or d.draw() if used inside the context.

import schemdraw
import schemdraw.elements as elm

with schemdraw.Drawing() as d:
    R = elm.Resistor()
    elm.Line().down()
    elm.Capacitor().tox(R.start)
    elm.Lamp().to(R.start)
    d.draw()
image

while the same code with last line shifted left gives

image
cdelker commented 5 months ago

The draw() should be unnecessary since exiting the context manager takes care of drawing already. But dd509fc692cca00490e50941d0543c3203635aeb fixes it so that calling draw within the context flushes the element list and works as expected.