אודה לכל עזרה.
כתבתי קוד פשוט, כדי להתאמן, אבל אני לא מצליח לקבל תוצאה נורמלית; הייתי רוצה שה-DIV (עם הצבע) תמלא את כל העמוד ולא רק את השורה הראשונה. הנה הקוד:
page1 = "BONJOUR"
page2 = "AUREVOIR"
menu = "menu"
app = Dash(__name__, suppress_callback_exceptions = True)
app.layout = html.Div(
[
dcc.Location(id='url', refresh=False),
html.Div(id = 'current_page')
],
id = 'root',
style = {}
)
@callback(
[Output('current_page', 'children'), Output('root', 'style')],
Input('url', 'pathname')
)
def pages(pathname):
if pathname == "/playersPage":
background = {'background':'lightgreen'}
return page1, background
elif pathname == "/teamsPage":
background = {'background':'lightblue'}
return page2, background
else:
background = {'background':'beige'}
return menu, background
app.run_server(debug=True, port=5000)
והנה התוצאה:

