ipywidgets
ipywidgets copied to clipboard
Question: Change button text style
Hi all!
Is there any way to change the style of the description of a widget? Specially at the moment I want to change the text color and size on a button. I want to create a clear red X buttod.
In the code below I have the button with an X but I want that bigger and red.
from ipywidgets import Button, Layout
b = Button(description = 'x',
style = {'button_color': 'transparent'},
layout = Layout(width = '30px'))
b
Hi At least you can use CSS classes. Like:
%%html
<style>.myclass { color:red ; font-size:200%}
from ipywidgets import Button, Layout
b = Button(description = 'x',
style = {'button_color': 'transparent'},
layout = Layout(width = '30px'))
b.add_class('myclass')
b
This worked well for me, is there also a way to change the class one it is set ?
%%html <style>.myclass { color:red ; font-size:200%}
from ipywidgets import Button, Layout b = Button(description = 'x', style = {'button_color': 'transparent'}, layout = Layout(width = '30px')) b.add_class('myclass') b
Do you know how this would work in ?