rob-vh
rob-vh
SSolara
Created by sujith on 8/13/2024 in #questions-issues
error-empty page after execution
whereas in py.cafe it works fine
15 replies
SSolara
Created by Brian on 8/5/2024 in #questions-issues
Creating a form when I don't know how many user inputs there will be at development time
Here is an example of a table driven editor, using a dataframe. https://py.cafe/rob.on.lists/solara-inventory-tracker-using_dummy_reactive To display the updates to the df, I use a reactive that I just increment. I could also have stored the whole dict in the reactive, but then updates (!) to the dict are not taken as changes, unless I first overwrite the reactive with None. https://py.cafe/rob.on.lists/solara-inventory-editor-only-works-first-time I believe is issue is here https://github.com/widgetti/solara/issues/245
9 replies
SSolara
Created by rob-vh on 7/16/2024 in #questions-issues
process results of a field change to another element level
I now have a component with a dynamic number of input fields, each input field contains an on_value callback to update a top-level dict with the field names and the change made to the field. The "inventory counts" are in a dict and I save this into a reactive value after each update to the dict. I have the reactive value in my call to solara.DataFrame, but only the first change is reflected in the output of Page(), subsequent changes are made to the reactive value, but not displayed: https://py.cafe/rob.on.lists/solara-inventory-editor-only-works-first-time Is this related to https://github.com/widgetti/solara/issues/245 Since I have to massage the data anyway, before displaying, I changed the logic to use a simple counter as reactive value. The reactive field is just a dummy parameter that only causes the DataFrame element to be re-evaluated and rendered. https://py.cafe/rob.on.lists/solara-inventory-tracker-using_dummy_reactive Is there a more "reactonic" way to trigger the Page() to evaluate and render the DataFrame?
2 replies
SSolara
Created by rob-vh on 7/12/2024 in #questions-issues
Send components to another browser tab or window
ipypopout is nice It takes an element in the Page() and copies it to a new Window. However, I do not need the element twice, I only need the info in the new Window. Is there a test I can write in the element, so that it no longer displays in the Page() component, but only in the new Window? Or can I refer the PopoutButton to a widget in another component (that is not displayed)?
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 would love seeing this sample https://py.cafe/rob.on.lists/solara-switch-button-interaction improved, e.g., with a class for reactive_value, instead of a generator function.
17 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 ended up setting the reactive value after rebuilding the button in the body of the element using the use_state value, instead of within the event handler.
17 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've simplified handling of the state variables now that I better understand that the body of the elements is executed several times when a click occurs, and the use_state hook has logic to deal with multiple invocations. If only I had read this https://solara.dev/documentation/advanced/understanding/anatomy first.
17 replies
SSolara
Created by rob-vh on 7/4/2024 in #questions-issues
Need a button with a label that changes with each click
@Iisakki Rotko I am getting more confused 😉 I updated https://py.cafe/rob.on.lists/solara-switch-button-interaction and have the value from my button(s) now accessible in the Page() element. But I notice that the python code in SwitchButton's body gets accessed way more frequently than I expected, the body (with parameter processing) gets called very time I press the button, not just the on_click function. OK... I think I can deal with that 🤨 But I do not understand why the first click on the button is ineffective? I initialize the value to 0 (uit) I click on the UIT value and it does not change to AAN. Only the 2nd click changes it. Note: I use reactive to set the global switch fields, and use_state for display/click processing.
17 replies
SSolara
Created by rob-vh on 7/4/2024 in #questions-issues
Need a button with a label that changes with each click
can you just point me to documentation (or tell me from your memory) if it is possible to retrieve the click count from the ButtonClick instance (https://solara.dev/documentation/api/hooks/use_state) in a python var in the Page() element?
17 replies
SSolara
Created by rob-vh on 7/4/2024 in #questions-issues
Need a button with a label that changes with each click
oh, no, I am doing my typing on my local instance
17 replies
SSolara
Created by rob-vh on 7/4/2024 in #questions-issues
Need a button with a label that changes with each click
ok, I am going to be VERY CAREFULLY rerun my steps, keeping in mind your last comment.
17 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 also found that my observation of the initial state changed after I re-ran.
17 replies
SSolara
Created by rob-vh on 7/4/2024 in #questions-issues
Need a button with a label that changes with each click
Adding some print() commands I verified: - use_state() defined in the button is specific for the button - the uitaan.value that I display in the Page() element does not follow the switchButton related to uitaan, you click the left button, sometimes the value for the right button changes
17 replies
SSolara
Created by rob-vh on 7/4/2024 in #questions-issues
Need a button with a label that changes with each click
Thank you @lisakki, I replaced the reactive references inside the component to use_reactive in https://py.cafe/rob.on.lists/solara-switch-button-interaction The uitaan button influences the value in linksrechts when you press it repeatedly. Also, at startup, before I press a button, the initial value I set in the Page component does not show up in the Markdown output. Note, I'm trying to use the name space of the SwitchButton component to keep the 2 buttons separated, but I do not know if use_reactive also uses separate namespaces. And regarding my initial attempt with reactive, instead of use_reactive, there was no error message, just spotty behavior.
17 replies
SSolara
Created by rob-vh on 7/2/2024 in #questions-issues
automatic reload not working (new user) (fixed)
Dat werkt helemaal goed, dank voor de vliegendvlugge fix.
20 replies
SSolara
Created by rob-vh on 7/2/2024 in #questions-issues
automatic reload not working (new user) (fixed)
to the point of even checking the contents (I did not really change the file, I just added+deleted a blank, and saved).
20 replies
SSolara
Created by rob-vh on 7/2/2024 in #questions-issues
automatic reload not working (new user) (fixed)
when I do the same with streamlit run --logger.level debug main.py 2024-07-03 12:26:46.884 Watcher created for /home/rob/Documents/henri/pyracf_browser/make_stylable.py 2024-07-03 12:26:46.885 Watcher created for /home/rob/Documents/henri/pyracf_browser/field_spec.py and update main.py using geany, I see that streamlit ignores the .goutputstream update but then proceeds to check the status of tracked files in the directory:
20 replies
SSolara
Created by rob-vh on 7/2/2024 in #questions-issues
automatic reload not working (new user) (fixed)
20 replies
SSolara
Created by rob-vh on 7/2/2024 in #questions-issues
automatic reload not working (new user) (fixed)
when I go into the terminal window and do a touch sol.py there is a reaction, and the app window changes. however! when I do the exact same things with streamlit run, using either geany or text edit, streamlit notices and shows the 'rerun' option (or does auto-rerun if so configured)
20 replies