Toggle dark mode

Hi,

🎉 V2.0 is out. 

Check out our new release!

M

Reply To: Using file_selector ‘on_action’ callback

Welcome to Taipy Forums Using Taipy Using file_selector ‘on_action’ callback Reply To: Using file_selector ‘on_action’ callback

#237135
Florian JactaFlorian Jacta
Keymaster

Hi Greg,

I have created a little code for you to help you use this control. This control is attached to a Python variable (here “path”). The value will be the path of the selected file. The real-time value of “path” can be found in the State object as below. The State object contains every GUI variable used by the application (https://docs.taipy.io/en/latest/getting_started/step_02/ReadMe/#multi-client—state).

———–
from taipy.gui import Gui
import pandas as pd

path = None

md = “<|{path}|file_selector|label=Upload dataset|on_action=load_csv_file|extensions=.csv|>”

def load_csv_file(state):
data = pd.read_csv(state.path)
print(data)

Gui(md).run()
———–

I hope that helps. If you need anything else, feel free to ask.
Florian