Forum Discussion

Master's avatar
Master
Icon for Helper I rankHelper I
2 years ago

end user UI in notebook

Is there a way to present a form to users in a fabric notebook and retrieve the data entered either with a Python UI library such as tkinter or with an HTML form?

 

In the first case (Tkinter), it is impossible to display anything, there is no "display".

 

In the second case (HTML), it is impossible to return the data to my python code of the notebook that displayed the form (but the form works).

 

Thank you for your help

10 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Master 

     

    I have no experience with tkinter or HTML form. I tried ipywidgets to collect some data and it retrieved the data to the notebook. Below is my test result. You may give it a try!

    import ipywidgets as widgets
    
    # Create form widgets
    name = widgets.Text(description="Name:")
    age = widgets.IntText(description="Age:")
    submit_button = widgets.Button(description="Submit")
    
    # Function to handle form submission
    def on_submit(button):
        print(f"Name: {name.value}, Age: {age.value}")
    
    # Attach the function to the button
    submit_button.on_click(on_submit)
    
    # Display the form
    display(name, age, submit_button)
    
    displayString = "Welcome to Fabric, " + name.value + "!"
    display(displayString)

     

    The Python environment in the notebook is PySpark, not a native Python. Therefore, some Python libraries might not work well in the Fabric notebook, as its primary purpose is for data engineering and data science, not for App development. If you need to design complex forms or collect a lot of data, it's better to use other tools to collect the information in advance and export it to a file format that the Fabric notebook can handle.

     

    Best Regards,
    Jing
    If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

    • Master's avatar
      Master
      Icon for Helper I rankHelper I

      yes, I know, there is only ipywidgets that works but it is not with that that I will give an interesting experience worthy of 2024 to the end users. see my other comments. thank you

  • Anonymous's avatar
    Anonymous
    Not applicable

    I did some more research, below are some additional information regarding tkinter

     

    Why tkinter is not suitable for Fabric notebooks:

    tkinter is a Python library used for creating graphical user interfaces (GUIs). It relies on a display server to render the GUI elements. In environments like Fabric notebooks, which are often run on remote servers or in headless setups (without a graphical display), there is no display server available. This leads to errors like TclError: no display name and no $DISPLAY environment variableInstead, you can use ipywidgets or other notebook-friendly libraries.

     

    Best Regards,
    Jing

    • Master's avatar
      Master
      Icon for Helper I rankHelper I

      Maybe before notebooks were reserved for data scientists and for their own use but this is no longer the case in 2024. Soon (Q3 2024), we will even be able to publish a notebook in a Power BI application. Notebooks become an alternative method to present user data. We then have the immensity of python libraries, the possibilities multiply enormously by delivering notebook solutions to end users. This will be increasingly used in this sense.

  • The need to create user-friendly forms for end users is to integrate data update functions. For example, allowing them to update thresholds, etc. Offering this directly in Microsoft Fabric would allow us to avoid other application infrastructure. In addition, there are a lot of users who ask us: "can we update data with Power BI". Many people are looking for an easy way to update data in Power BI. ipwydgets is definitely not a library allowing us to data a user-friendly interface, it feels like the 80s.

    • lbendlin's avatar
      lbendlin
      Icon for Super User rankSuper User

      Data modification in Power BI (aka "Data Write Back")  has been a sore spot for years. Technically you should not write into a downstream system (you should write into the system that feeds Power BI) but there are ways to make that process work seamlessly -  for example by first modifying the sematic model (for good UX) and then in the background sync the change with the data source.

       

      As for the notebooks - are you sure you want to expose that part of the process to end users?

      • Master's avatar
        Master
        Icon for Helper I rankHelper I

        No, this is not data that is necessarily subject to return to the source systems. In most cases, this is data that is strictly useful for data analysis. In addition, third-party applications are often used in SaaS mode and it is not possible to add data to the source system.

        The idea is to add additional analysis data at the warehouse level to enable rich and dynamic BI solutions.

        Similarly, the idea is that the data specialist team can do the work with data world technologies (Python) without needing to have knowledge of C# development for example.

  • Hi,

    Does anyone have any news regarding this issue/need?