Update app.py
Browse files
app.py
CHANGED
@@ -1,61 +1,59 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
# Set page config
|
4 |
-
st.set_page_config(page_title="
|
5 |
|
6 |
-
#
|
7 |
-
|
8 |
-
st.
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
st.markdown("### My Application")
|
17 |
-
tab1, tab2, tab3 = st.tabs(["Section 1", "Section 2", "Section 3"])
|
18 |
-
|
19 |
-
with tab1:
|
20 |
-
if st.button("Go to Section 1"):
|
21 |
-
st.session_state.current_section = "section1"
|
22 |
-
st.experimental_rerun()
|
23 |
-
|
24 |
-
with tab2:
|
25 |
-
if st.button("Go to Section 2"):
|
26 |
-
st.session_state.current_section = "section2"
|
27 |
-
st.experimental_rerun()
|
28 |
-
|
29 |
-
with tab3:
|
30 |
-
if st.button("Go to Section 3"):
|
31 |
-
st.session_state.current_section = "section3"
|
32 |
-
st.experimental_rerun()
|
33 |
|
34 |
-
#
|
35 |
-
|
36 |
|
37 |
-
# Display content based on
|
38 |
-
if
|
39 |
st.header("Section 1")
|
40 |
st.write("This is section 1 content")
|
41 |
-
for i in range(
|
42 |
st.write(f"Content line {i}")
|
43 |
|
44 |
-
elif
|
45 |
st.header("Section 2")
|
46 |
st.write("This is section 2 content")
|
47 |
-
for i in range(
|
48 |
st.write(f"Content line {i}")
|
49 |
|
50 |
-
elif
|
51 |
st.header("Section 3")
|
52 |
st.write("This is section 3 content")
|
53 |
-
for i in range(
|
54 |
st.write(f"Content line {i}")
|
55 |
|
56 |
-
# Add
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
|
61 |
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
# Set page config
|
4 |
+
st.set_page_config(page_title="Multipage Navigation", layout="wide")
|
5 |
|
6 |
+
# Use sidebar as a persistent navigation element (this is always visible)
|
7 |
+
with st.sidebar:
|
8 |
+
st.title("My Application")
|
9 |
+
st.markdown("### Navigation")
|
10 |
+
|
11 |
+
nav_option = st.radio(
|
12 |
+
"Go to:",
|
13 |
+
["Section 1", "Section 2", "Section 3"],
|
14 |
+
key="nav_radio"
|
15 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
+
# Main content area
|
18 |
+
st.title("My Application")
|
19 |
|
20 |
+
# Display content based on navigation selection
|
21 |
+
if nav_option == "Section 1":
|
22 |
st.header("Section 1")
|
23 |
st.write("This is section 1 content")
|
24 |
+
for i in range(15):
|
25 |
st.write(f"Content line {i}")
|
26 |
|
27 |
+
elif nav_option == "Section 2":
|
28 |
st.header("Section 2")
|
29 |
st.write("This is section 2 content")
|
30 |
+
for i in range(15):
|
31 |
st.write(f"Content line {i}")
|
32 |
|
33 |
+
elif nav_option == "Section 3":
|
34 |
st.header("Section 3")
|
35 |
st.write("This is section 3 content")
|
36 |
+
for i in range(15):
|
37 |
st.write(f"Content line {i}")
|
38 |
|
39 |
+
# Add "quick jump" buttons at the bottom
|
40 |
+
st.markdown("### Quick Navigation")
|
41 |
+
col1, col2, col3 = st.columns(3)
|
42 |
+
|
43 |
+
with col1:
|
44 |
+
if st.button("Jump to Section 1"):
|
45 |
+
st.session_state.nav_radio = "Section 1"
|
46 |
+
st.experimental_rerun()
|
47 |
+
|
48 |
+
with col2:
|
49 |
+
if st.button("Jump to Section 2"):
|
50 |
+
st.session_state.nav_radio = "Section 2"
|
51 |
+
st.experimental_rerun()
|
52 |
+
|
53 |
+
with col3:
|
54 |
+
if st.button("Jump to Section 3"):
|
55 |
+
st.session_state.nav_radio = "Section 3"
|
56 |
+
st.experimental_rerun()
|
57 |
|
58 |
|
59 |
|