packages = ["whl/schemdraw-0.16a1-py3-none-any.whl"]

Logic Gates by Schemdraw

Enter a logic expression

=




Gate Height


import asyncio from js import document, Object, window, console from pyodide.ffi import to_js, create_proxy from schemdraw.parsing import logicparse async def drawit(): expr = Element("expression").value outlabel = Element("outlabel").value gateH = float(Element("height").value) d = logicparse(expr, outlabel=outlabel, gateH=gateH) display(d, target='schematic', append=False) async def file_save(): try: options = {"startIn": "downloads", "suggestedName": "logic.svg"} fileHandle = await window.showSaveFilePicker(Object.fromEntries(to_js(options))) except Exception as e: console.log('Exception: ' + str(e.args)) return expr = Element("expression").value d = logicparse(expr) file = await fileHandle.createWritable() await file.write(d.get_imagedata().decode('utf-8')) await file.close() return drawit()