You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have pieced together two examples from the documentation, creating a spreadsheet that renders the background colors of a changing value:
import ipywidgets as widgets
import ipysheet
jscode_renderer_negative = """function (value) {
return {
backgroundColor: value < 0 ? 'lightpink' : 'lightgreen'
};
}
"""
ipysheet.renderer(code=jscode_renderer_negative, name='negative');
sheet = ipysheet.sheet(rows=3, columns=2, column_headers=False, row_headers=False)
cell_a = ipysheet.cell(0, 1, 1, label_left='a', renderer='negative')
cell_b = ipysheet.cell(1, 1, 2, label_left='b', renderer='negative')
cell_sum = ipysheet.cell(2, 1, 3, label_left='sum', read_only=True, renderer='negative')
# create a slider linked to cell a
slider = widgets.FloatSlider(min=-10, max=10, description='a', layout=widgets.Layout(width='50%'))
widgets.jslink((cell_a, 'value'), (slider, 'value'))
# changes in a or b should trigger this function
def calculate(change):
cell_sum.value = cell_a.value + cell_b.value
cell_a.observe(calculate, 'value')
widgets.VBox([sheet, slider])
When I move the slider in the positive realm, the columns remain stable. When I move to the negative realm, sometimes the column width changes dramatically, from the normal 50/50 break expected with two columns to a 25/75 break.
This happens in particular as I move from -4 to -3.5 using the arrow key to move in increments of 0.1. When I remove the javascript renderer, the column widths change very subtly, likely as the widget is recalculating the width differences due to the slize of the rendered numbers.
Please let me know what scripts you'd like me to run if you need additional information.
The text was updated successfully, but these errors were encountered:
I have pieced together two examples from the documentation, creating a spreadsheet that renders the background colors of a changing value:
When I move the slider in the positive realm, the columns remain stable. When I move to the negative realm, sometimes the column width changes dramatically, from the normal 50/50 break expected with two columns to a 25/75 break.
This happens in particular as I move from -4 to -3.5 using the arrow key to move in increments of 0.1. When I remove the javascript renderer, the column widths change very subtly, likely as the widget is recalculating the width differences due to the slize of the rendered numbers.
Please let me know what scripts you'd like me to run if you need additional information.
The text was updated successfully, but these errors were encountered: