rob-vh
rob-vh
SSolara
Created by rob-vh on 7/16/2024 in #questions-issues
process results of a field change to another element level
I would like to trigger python code each time one of the input fields in a page is updated, the result of the python code should be shown in a message box at Page() level. https://py.cafe/rob.on.lists/solara-markdown-message-editor I know how to display a reactive variable in a field on Page(), when it is changed/set in another element, but I can't get my mind around triggering python statements. Should I propagate the on_value condition from the propagate() routine up to MarkDownEditor elements in Page()? How do you propagate conditions?
2 replies
SSolara
Created by rob-vh on 7/13/2024 in #questions-issues
What are the limitations/restrictions of solara.DataFrame()?
My application has a beefed-up class of DataFrames, with several methods added, and solara.DataFrame dies when I want to display it: TypeError: <class 'main.MyFrame'> not supported import pandas as pd import solara class MyFrame(pd.DataFrame): @property def _constructor(self): '''result of a method is also a MyFrame''' return MyFrame def myFilter(self,a): return self.filter(a) std_frame = pd.DataFrame({'a':[1,2,3,4], 'b':[5,6,7,8]}) my_frame = MyFrame({'a':[5,6,7,8], 'b':[9,10,11,12]}) @solara.component def detailsFrame(df,value=slice(None)): print(df.shape) return solara.DataFrame(df.loc[value]) @solara.component def Page(): detailsFrame(my_frame) So this works with: detailsFrame(std_frame) detailsFrame(pd.DataFrame(my_frame)) but not with detailsFrame(my_frame) Are there more restrictions I should be aware of?
1 replies
SSolara
Created by rob-vh on 7/12/2024 in #questions-issues
Send components to another browser tab or window
I have an application composed of 100 BIG dataframes. I can navigate through the dfs in one tab/window. The users click on a row in a df to do a simulation, the result of the simulation is another df. I see how we can do this with solara.Dataframe. We want the resulting df presented in a separate browser tab (or a separate window), because the user wants to see the results of several simulations side by side (not in solara.Tabs or grid). Is there a way to open another browser window, running solara components that use python objects from the application, or send a df to the new browser window? Opening a URL with a copy of the main app would not work well, because of the time required to load dfs again (and the RAM needed to load several copies side by side). I do not like to save the result of the simulation to disk, and open it again from another browser's app, so is there an alternative?
3 replies
SSolara
Created by rob-vh on 7/4/2024 in #questions-issues
Need a button with a label that changes with each click
I am not sure if this is a solara question, or a vue issue. I need a button that switches between 2 values (OFF/ON) and also shows the value (text) in the button label field. I think I have a solution in https://py.cafe/rob.on.lists/solara-interactive-toggles However... some of the clicks do make the switch change value, some of the clicks are seemingly ignored. Also, I need more than one button, and enabling the 2nd button makes me wonder if the reactive id is passed by name, or by reference. Because sometimes when I press the right button, the left value changes.
17 replies
SSolara
Created by rob-vh on 7/2/2024 in #questions-issues
automatic reload not working (new user) (fixed)
I have just installed solara on linux mint 20.3 (based on ubuntu 20.04). I have a sol.py on local directory (a copy of apps/tutorial-streamlit.py) and started solara run sol.py in a terminal window as suggested in the tutorial. My firefox opens automatically and I see the first web page. Great. Success at the first attempt. I modify the file (locally) and save. The browser window is not refreshed, I see no message in the terminal window. I check ls -l and the time stamp of sol.py was changed. I open a 2nd session with localhost:8765 and (of course) the same old app is shown. When I do the same with streamlit run main.py the streamlit app window refreshes. 1. should the app refresh? I did not specify --production 2. is there some way to figure out why I do not get a new window? Note: I had only done pip3 install solara, and apps/tutorial-streamlit.py complained that it could not find the markdown module. It worked after pip3 install markdown ... Is that as expected?
20 replies