-
Notifications
You must be signed in to change notification settings - Fork 2
/
example_app_with_option_menu.py
49 lines (44 loc) · 1.44 KB
/
example_app_with_option_menu.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import streamlit as st
from datetime import date, datetime, time
import streamlit_permalink as stp
# 1. as sidebar menu
with st.sidebar:
selected = stp.option_menu("Sidebar Menu", ["Home", 'Settings'], url_key='sidebar_menu',
icons=['house', 'gear'], menu_icon="cast", default_index=1)
selected
# 2. horizontal menu
selected2 = stp.option_menu(None, ["Home", "Upload", "Tasks", 'Settings'], url_key='horizontal_menu',
icons=['house', 'cloud-upload', "list-task", 'gear'],
menu_icon="cast", default_index=0, orientation="horizontal")
selected2
# 3. CSS style definitions
selected3 = stp.option_menu(None, ["Home", "Upload", "Tasks", 'Settings'], url_key='horizontal_menu2',
icons=['house', 'cloud-upload', "list-task", 'gear'],
menu_icon="cast", default_index=0, orientation="horizontal",
styles={
"container": {"padding": "0!important", "background-color": "#fafafa"},
"icon": {"color": "orange", "font-size": "25px"},
"nav-link": {"font-size": "25px", "text-align": "left", "margin":"0px", "--hover-color": "#eee"},
"nav-link-selected": {"background-color": "green"},
}
)
loc = locals().copy()
irrelevant = [
"__name__",
"__doc__",
"__package__",
"__loader__",
"__spec__",
"__file__",
"__builtins__",
"st",
"__streamlitmagic__",
"stp",
"datetime",
"date",
"time",
]
for i in irrelevant:
if i in loc:
del loc[i]
st.write(loc)