jupyter-widgets / ipywidgets

Interactive Widgets for the Jupyter Notebook
https://ipywidgets.readthedocs.io
BSD 3-Clause "New" or "Revised" License
3.16k stars 950 forks source link

FloatSlider and IntSlider didn't show up! #3207

Open tasanyphy01773 opened 3 years ago

tasanyphy01773 commented 3 years ago

I'm using ipywidget for metPy dewdrop calculator. But the sliders didn't show up when I run the code. My Code: image

import metpy.calc as mpcalc
from metpy.units import units 

from ipywidgets import interact, FloatSlider, IntSlider

def dewpoint_calculator(temperature, rh):
    temperature = temperature * units.degC
    rh = rh * units.percent
    return round(mpcalc.dewpoint_from_relative_humidity(temperature, rh).to('degC'), 1)

temp_slider = FloatSlider(min=0, max=100, step=0.5, value= 50)
rh_slider = IntSlider(min=0, max=100, value= 50)

interact(dewpoint_calculator, temperature=temp_slider, rh =rh_slider);

It should be like this: image

afonit commented 3 years ago

I went ahead and installed metpy to see if I could reproduce, the widget shows up fine for me.

Here are my package versions: metpy = 1.0.1 jupyterlab = 3.0.15 ipywidgets = 7.6.3

Here is the code and output (thank you for including the code to reproduce): image

If you are using chrome - have you checked the console to see if you are getting any errors? (top right three dots -> More Tools -> Developer Tools

Have you tried doing this in a clean python environment?