Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +11 -10
src/streamlit_app.py
CHANGED
|
@@ -299,13 +299,13 @@ def main():
|
|
| 299 |
# Sidebar controls
|
| 300 |
st.sidebar.header("๐๏ธ Controls")
|
| 301 |
|
| 302 |
-
# Enhanced function selection
|
| 303 |
st.sidebar.subheader("๐ Function Plots")
|
| 304 |
col1, col2 = st.sidebar.columns(2)
|
| 305 |
with col1:
|
| 306 |
-
show_primary = st.checkbox("Primary Functions", value=True)
|
| 307 |
with col2:
|
| 308 |
-
show_reciprocal = st.checkbox("Reciprocal Functions", value=False)
|
| 309 |
|
| 310 |
selected_functions = []
|
| 311 |
if show_primary:
|
|
@@ -314,25 +314,26 @@ def main():
|
|
| 314 |
selected_functions.extend(['csc', 'sec', 'cot'])
|
| 315 |
|
| 316 |
# Plot options
|
| 317 |
-
plot_range = st.sidebar.slider("Plot range (degrees)", 180, 720, 360, 90)
|
| 318 |
-
show_special_angles = st.sidebar.checkbox("Show special angle markers", value=True)
|
| 319 |
|
| 320 |
# Enhanced angle input - MOVED AFTER FUNCTION SELECTION
|
| 321 |
angle_input_method = st.sidebar.radio(
|
| 322 |
"Choose angle input method:",
|
| 323 |
-
["Slider", "Text Input", "Common Angles", "Auto Animation"
|
|
|
|
| 324 |
)
|
| 325 |
|
| 326 |
# Enhanced angle input method
|
| 327 |
st.sidebar.subheader("๐ง Settings")
|
| 328 |
-
angle_unit = st.sidebar.radio("Angle Units:", ["Degrees", "Radians"])
|
| 329 |
|
| 330 |
# Modify angle input methods to support both units
|
| 331 |
if angle_input_method == "Slider":
|
| 332 |
if angle_unit == "Degrees":
|
| 333 |
-
angle = st.sidebar.slider("Angle (degrees)", 0, 360, 45, 5)
|
| 334 |
else:
|
| 335 |
-
angle_rad = st.sidebar.slider("Angle (radians)", 0.0, 2*pi, pi/4, 0.1)
|
| 336 |
angle = degrees(angle_rad)
|
| 337 |
|
| 338 |
elif angle_input_method == "Text Input":
|
|
@@ -452,7 +453,7 @@ def main():
|
|
| 452 |
|
| 453 |
# Add a mini calculator
|
| 454 |
st.subheader("๐งฎ Quick Calculator")
|
| 455 |
-
calc_angle = st.number_input("Calculate for angle:", value=float(angle), step=1.0)
|
| 456 |
calc_values = calculate_trig_functions(radians(calc_angle))
|
| 457 |
|
| 458 |
col_calc1, col_calc2 = st.columns(2)
|
|
|
|
| 299 |
# Sidebar controls
|
| 300 |
st.sidebar.header("๐๏ธ Controls")
|
| 301 |
|
| 302 |
+
# Enhanced function selection
|
| 303 |
st.sidebar.subheader("๐ Function Plots")
|
| 304 |
col1, col2 = st.sidebar.columns(2)
|
| 305 |
with col1:
|
| 306 |
+
show_primary = st.checkbox("Primary Functions", value=True, key="show_primary_funcs")
|
| 307 |
with col2:
|
| 308 |
+
show_reciprocal = st.checkbox("Reciprocal Functions", value=False, key="show_reciprocal_funcs")
|
| 309 |
|
| 310 |
selected_functions = []
|
| 311 |
if show_primary:
|
|
|
|
| 314 |
selected_functions.extend(['csc', 'sec', 'cot'])
|
| 315 |
|
| 316 |
# Plot options
|
| 317 |
+
plot_range = st.sidebar.slider("Plot range (degrees)", 180, 720, 360, 90, key="plot_range_slider")
|
| 318 |
+
show_special_angles = st.sidebar.checkbox("Show special angle markers", value=True, key="show_special_angles_cb")
|
| 319 |
|
| 320 |
# Enhanced angle input - MOVED AFTER FUNCTION SELECTION
|
| 321 |
angle_input_method = st.sidebar.radio(
|
| 322 |
"Choose angle input method:",
|
| 323 |
+
["Slider", "Text Input", "Common Angles", "Auto Animation",
|
| 324 |
+
key="angle_input_method_radio"]
|
| 325 |
)
|
| 326 |
|
| 327 |
# Enhanced angle input method
|
| 328 |
st.sidebar.subheader("๐ง Settings")
|
| 329 |
+
angle_unit = st.sidebar.radio("Angle Units:", ["Degrees", "Radians"], key="angle_unit_radio")
|
| 330 |
|
| 331 |
# Modify angle input methods to support both units
|
| 332 |
if angle_input_method == "Slider":
|
| 333 |
if angle_unit == "Degrees":
|
| 334 |
+
angle = st.sidebar.slider("Angle (degrees)", 0, 360, 45, 5, key="angle_degrees_slider")
|
| 335 |
else:
|
| 336 |
+
angle_rad = st.sidebar.slider("Angle (radians)", 0.0, 2*pi, pi/4, 0.1, key="angle_radians_slider")
|
| 337 |
angle = degrees(angle_rad)
|
| 338 |
|
| 339 |
elif angle_input_method == "Text Input":
|
|
|
|
| 453 |
|
| 454 |
# Add a mini calculator
|
| 455 |
st.subheader("๐งฎ Quick Calculator")
|
| 456 |
+
calc_angle = st.number_input("Calculate for angle:", value=float(angle), step=1.0, key="calc_angle_input")
|
| 457 |
calc_values = calculate_trig_functions(radians(calc_angle))
|
| 458 |
|
| 459 |
col_calc1, col_calc2 = st.columns(2)
|