cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I change the font size on ipywidgets in a Databricks notebook?

Michael_Marquis
New Contributor II

I'm trying to create a simple UI for a notebook using the recently implemented support for ipywidgets, but I'm having a hard time figuring out how to change certain style attributes like font size and color in widgets that should accept those style parameters according the the ipywidgets documentation.

For example, if I run the following code snippet (taken directly from the ipywidget docs), none of these style parameters seems to have any effect on the widget that is created:

b3 = widgets.Button(description='Styled button', style=dict(
	    font_style='italic',
	    font_variant="small-caps",
	    text_color='red',
	    text_decoration='underline'
	     ))
display(b3)

Similarly, if I run b3.style.keys in a new cell after executing the above code, the output doesn't include any of those style parameters.

I've run into this same issue with a number of different widgets, and it's really inconvenient not to be able to change font sizes on individual widgets even when I scale them. Is this an additional limitation of ipywidgets in Databricks? It's not listed as such on on the Databricks website so I'm wondering if there's a simple answer that I'm missing.

1 REPLY 1

Miguel_Suarez
New Contributor III

Hey Michael,

The example you're trying to run is for ipywidgets 8, we currently have ipywidgets 7-which has fewer button customizations. I believe the only font customization available in 7 is "font_weigh t" (no space).

I hope this helps.

Best,

Miguel

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group