File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 11"""This example demonstrates how to open/update a Streamlit application using nipanel package."""
22
3+ import itertools
4+ import math
35import pathlib
46
57import nipanel
1719panel .set_value ("sample_float" , 3.14 )
1820panel .set_value ("sample_bool" , True )
1921
22+ x_values = [float (x ) for x in itertools .takewhile (lambda p : p < 2 * math .pi , itertools .count (0 , 0.05 ))]
23+ y_values = [math .sin (x ) for x in x_values ]
24+ panel .set_value ("x_values" , x_values )
25+ panel .set_value ("y_values" , y_values )
26+
2027input ("Press Enter to close the panel..." )
2128
2229panel .close_panel (reset = True )
Original file line number Diff line number Diff line change 11"""Streamlit application script for displaying values using nipanel package."""
22
3+ import pandas as pd
34import streamlit as st
45
56import nipanel
1516 st .write ("Integer" )
1617 st .write ("Float" )
1718 st .write ("Boolean" )
19+ st .write ("Line" )
1820
1921with col2 :
2022 st .write (panel .get_value ("sample_string" ))
2123 st .write (panel .get_value ("sample_int" ))
2224 st .write (panel .get_value ("sample_float" ))
2325 st .write (panel .get_value ("sample_bool" ))
26+ st .line_chart (
27+ data = pd .DataFrame (
28+ {
29+ "x" : panel .get_value ("x_values" ),
30+ "y" : panel .get_value ("y_values" ),
31+ }
32+ ),
33+ x = "x" ,
34+ y = "y" ,
35+ x_label = "x" ,
36+ y_label = "sin(x)" ,
37+ )
You can’t perform that action at this time.
0 commit comments