<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Databricks notebook ipywidgets not working as expected ( button click issue) in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8838#M4369</link>
    <description>&lt;P&gt;well it does print, but not in the notebook.  it prints to the standard output of the driver (which you can find in the logs of the cluster).&lt;/P&gt;&lt;P&gt;So I guess you have to use something else than print, I am no widget expert though.&lt;/P&gt;</description>
    <pubDate>Thu, 23 Feb 2023 12:17:18 GMT</pubDate>
    <dc:creator>-werners-</dc:creator>
    <dc:date>2023-02-23T12:17:18Z</dc:date>
    <item>
      <title>Databricks notebook ipywidgets not working as expected ( button click issue)</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8831#M4362</link>
      <description>&lt;P&gt;I am working on Azure databricks(IDE). I wanted to create a button which takes a text value as input and on the click of a button a function needed to be run which prints the value entered.&lt;/P&gt;&lt;P&gt;For that I created this code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;from IPython.display import display
import ipywidgets as widgets
&amp;nbsp;
def my_function(param):
    print(f"The parameter is: {param}")
&amp;nbsp;
text_input = widgets.Text(description="Enter text:")
button = widgets.Button(description="Click Me!")
&amp;nbsp;
display(text_input)
display(button)
&amp;nbsp;
def on_button_click(b):
    my_function(text_input.value)
&amp;nbsp;
button.on_click(on_button_click)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I click the button, nothing happens. It should run the `my_function` and print the input text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Strangely this exact code works fine when I run it in **jupyter notebook**.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not able to make it work in **Azure Databricks**.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any insights would be helpful&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 10:37:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8831#M4362</guid>
      <dc:creator>Shubham039</dc:creator>
      <dc:date>2023-02-23T10:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks notebook ipywidgets not working as expected ( button click issue)</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8832#M4363</link>
      <description>&lt;P&gt;databricks notebooks are not the same as jupyter notebooks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are widgets on databricks though (but not with a button afaik).&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/notebooks/widgets" alt="https://learn.microsoft.com/en-us/azure/databricks/notebooks/widgets" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/notebooks/widgets&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/notebooks/widgets.html" alt="https://docs.databricks.com/notebooks/widgets.html" target="_blank"&gt;https://docs.databricks.com/notebooks/widgets.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However you can use the ipython kernel:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/notebooks/ipython-kernel.html" target="test_blank"&gt;https://docs.databricks.com/notebooks/ipython-kernel.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But I am not sure if the button will work.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 10:55:05 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8832#M4363</guid>
      <dc:creator>-werners-</dc:creator>
      <dc:date>2023-02-23T10:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks notebook ipywidgets not working as expected ( button click issue)</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8833#M4364</link>
      <description>&lt;P&gt;Hi, I'm using the ipywidgets not the older databricks widgets.&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/notebooks/ipywidgets" target="test_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/notebooks/ipywidgets&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 10:59:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8833#M4364</guid>
      <dc:creator>Shubham039</dc:creator>
      <dc:date>2023-02-23T10:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks notebook ipywidgets not working as expected ( button click issue)</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8834#M4365</link>
      <description>&lt;P&gt;I see, I missed that.&lt;/P&gt;&lt;P&gt;Buttons should work according to the docs.&lt;/P&gt;&lt;P&gt;The example has output however, maybe that is the issue:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import ipywidgets as widgets
&amp;nbsp;
# Create button widget. Clicking this button loads a sampled dataframe from UC table.
button = widgets.Button(description="Load dataframe sample")
&amp;nbsp;
# Output widget to display the loaded dataframe
output = widgets.Output()
&amp;nbsp;
def load_sample_df(table_name):
  return spark.sql(f"SELECT * FROM {table_name} LIMIT 1000")
&amp;nbsp;
def on_button_clicked(_):
    with output:
      output.clear_output()
      df = load_sample_df('&amp;lt;catalog&amp;gt;.&amp;lt;schema&amp;gt;.&amp;lt;table&amp;gt;')
      print(df.toPandas())
&amp;nbsp;
# Register the button's callback function to query UC and display results to the output widget
button.on_click(on_button_clicked)
&amp;nbsp;
display(button, output)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 11:10:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8834#M4365</guid>
      <dc:creator>-werners-</dc:creator>
      <dc:date>2023-02-23T11:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks notebook ipywidgets not working as expected ( button click issue)</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8835#M4366</link>
      <description>&lt;P&gt;Did you try running my code snippet? Is it working fine?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 11:28:56 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8835#M4366</guid>
      <dc:creator>Shubham039</dc:creator>
      <dc:date>2023-02-23T11:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks notebook ipywidgets not working as expected ( button click issue)</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8836#M4367</link>
      <description>&lt;P&gt;yes and it does work.&lt;/P&gt;&lt;P&gt;your function prints to the standard output of the driver&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 12:01:59 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8836#M4367</guid>
      <dc:creator>-werners-</dc:creator>
      <dc:date>2023-02-23T12:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks notebook ipywidgets not working as expected ( button click issue)</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8837#M4368</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/614i4B323073B6862A80/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt; I Clicked on Click me, but there was no print statement for me.&lt;/P&gt;&lt;P&gt;Any reason why this issue?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 12:12:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8837#M4368</guid>
      <dc:creator>Shubham039</dc:creator>
      <dc:date>2023-02-23T12:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks notebook ipywidgets not working as expected ( button click issue)</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8838#M4369</link>
      <description>&lt;P&gt;well it does print, but not in the notebook.  it prints to the standard output of the driver (which you can find in the logs of the cluster).&lt;/P&gt;&lt;P&gt;So I guess you have to use something else than print, I am no widget expert though.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 12:17:18 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8838#M4369</guid>
      <dc:creator>-werners-</dc:creator>
      <dc:date>2023-02-23T12:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: Databricks notebook ipywidgets not working as expected ( button click issue)</title>
      <link>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8839#M4370</link>
      <description>&lt;P&gt;Hi @Shubham Ringne​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope everything is going great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just wanted to check in if you were able to resolve your issue. If yes, would you be happy to mark an answer as best so that other members can find the solution more quickly? If not, please tell us so we can help you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2023 10:24:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/databricks-notebook-ipywidgets-not-working-as-expected-button/m-p/8839#M4370</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-24T10:24:06Z</dc:date>
    </item>
  </channel>
</rss>

