stable-diffusion-webui/scripts/custom_components/draggable_number_input/__init__.py
Lucas Czernohorsky f630ee5c90 draggable number input component small fixes and visual improvements.
fixed drag being blocked by "press enter to apply" text.
2022-10-20 11:39:09 +02:00

11 lines
381 B
Python

import os
import streamlit.components.v1 as components
def load(pixel_per_step = 50):
parent_dir = os.path.dirname(os.path.abspath(__file__))
file = os.path.join(parent_dir, "main.js")
with open(file) as f:
javascript_main = f.read()
javascript_main = javascript_main.replace("%%pixelPerStep%%",str(pixel_per_step))
components.html(f"<script>{javascript_main}</script>")