cdelker/schemdraw

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

pozitron57 opened this issue · 1 comments

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

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