mirror of
https://github.com/wassname/baukit.git
synced 2026-06-27 17:14:53 +08:00
Fix imports, add Range step.
This commit is contained in:
@@ -43,6 +43,8 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
"""
|
||||
|
||||
import base64
|
||||
import io
|
||||
import json
|
||||
import html
|
||||
import re
|
||||
@@ -621,12 +623,13 @@ class Textbox(Widget):
|
||||
|
||||
|
||||
class Range(Widget):
|
||||
def __init__(self, value=50, min=0, max=100, **kwargs):
|
||||
def __init__(self, value=50, min=0, max=100, step=1, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
# databinding is defined using Property objects.
|
||||
self.value = Property(value)
|
||||
self.min = Property(min)
|
||||
self.max = Property(max)
|
||||
self.step = Property(step)
|
||||
|
||||
def widget_js(self):
|
||||
# Note that the 'input' event would enable during-drag feedback,
|
||||
@@ -644,7 +647,7 @@ class Range(Widget):
|
||||
|
||||
def widget_html(self):
|
||||
return f'''<input {self.std_attrs()} type="range" value="{
|
||||
self.value}" min="{self.min}" max="{self.max}">'''
|
||||
self.value}" min="{self.min}" max="{self.max}" step="{self.step}">'''
|
||||
|
||||
|
||||
class ColorPicker(Widget):
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from .labwidget import ImageWidget, Property
|
||||
from .labwidget import Image, Property
|
||||
import matplotlib, matplotlib.pyplot
|
||||
import inspect
|
||||
|
||||
class PlotWidget(ImageWidget):
|
||||
class PlotWidget(Image):
|
||||
"""
|
||||
A widget to create interactive matplotlib plots by defining a simple function.
|
||||
Example of usage:
|
||||
|
||||
Reference in New Issue
Block a user