what can I do next to test how it works
what can I do next to test how it works?... I check in both pc and cellphone ,the sidebar is still here by default
12 Replies
Looks to me like the
Layout
isn't getting rendered, since the print statement doesn't go through. Looks like you're running app.py
specifically, so you should either define your layout there, or run the entire thing as a python module.I add the AppLayout as the parent to all other components, it works! Yet my following code to control Mobile and PC display doesn't work as child ... is there something wrong?
nevermind ... it is done! ... it get confused when I forget the setting of my cellphone browser is PC mode... is there some best practice to check settings?
After I set sidebar to False... in PC mode it perform different where be come a subpanel, not have self width O.O
I'm not sure what you mean here, can you elaborate / share a screenshot of the new behaviour?
first one is sidebar_open=False, when i click sidebar and second one is default. Then are different
I think you probably have your
solara.AppLayout
in your Page
component. You should only use AppLayout
in the Layout
component, otherwise you are trying to nest multiple AppLayout
s, which isn't allowed.I can make sure this is the first because I don't know applayout before XDD
oh when I want to nest my page back to multiple page, things get wrong O.O there is to title!(with one is under new line for sidebar)
with solara.AppLayout(sidebar_open=False):
with solara.AppBarTitle():
solara.Text('B站功能控制台')
with solara.Head():
solara.Title("BiliCenter")
I prepared a short example code for debugging this issue
import solara
from solara import reactive
random_limit=reactive(10)
random_plan_limit=reactive(40)
@solara.component
def Page():
with solara.AppLayout(title='B站功能控制台'):## mark this line will change a lot ,make page viewed different
with solara.Sidebar():
solara.Markdown("#这里有一些设置")
with solara.Head(): solara.Title("BiliCenter")
with solara.Row(): solara.SliderInt(f'随机视频长度限制({random_limit.value}分钟)',value=random_limit,min=0,max=30) solara.Button("手气不错") solara.Button("设置已读") with solara.Row(): solara.SliderInt(f'临时阅读计划时间目标({random_plan_limit.value}分钟)',value=random_plan_limit,min=10,max=60) solara.Button("生成临时阅读计划") solara.Button("清理临时计划") Page()
with solara.Head(): solara.Title("BiliCenter")
with solara.Row(): solara.SliderInt(f'随机视频长度限制({random_limit.value}分钟)',value=random_limit,min=0,max=30) solara.Button("手气不错") solara.Button("设置已读") with solara.Row(): solara.SliderInt(f'临时阅读计划时间目标({random_plan_limit.value}分钟)',value=random_plan_limit,min=10,max=60) solara.Button("生成临时阅读计划") solara.Button("清理临时计划") Page()
Like I said here, you shouldn't use
solara.AppLayout
within the Page
component. If you move it to a Layout
component, it should work as expected. See here for an example.Discord
Discord - Group Chat That’s All Fun & Games
Discord is great for playing games and chilling with friends, or even building a worldwide community. Customize your own space to talk, play, and hang out.
PyCafe - Solara - BiliCenter Control Console
PyCafe: get your daily fix of Python!
Note that
solara.Title
always overrides the title given in solara.AppLayout
I got confused about that it seemed you didn't use your layout after defination?
@solara.component
def Layout(children=[]):
with solara.AppLayout(title='BiliCenter'):## mark this line will change a lot ,make page viewed different
solara.display(*children)
where i learn from the demo their always need to use, such like
Layout(Page())
what happened here?