none commited on
Commit
4a4f597
1 Parent(s): 045d7d4

Try to fix broken button color

Browse files
Files changed (1) hide show
  1. streamlit_viz.py +45 -3
streamlit_viz.py CHANGED
@@ -235,19 +235,61 @@ def main():
235
  layout=go.Layout(
236
  updatemenus=[{
237
  'type':'buttons',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
  'buttons':[{
239
  'label':'Play',
240
  'method': 'animate',
241
  'args':[None, {
242
  'frame': {'duration':5000},
243
- 'transition': {'duration': 2500}
244
- }]
245
- }]
 
 
 
 
 
 
246
  }]
247
  )
248
  )
249
  st.plotly_chart(ani_fig)
250
 
 
251
  if __name__=='__main__':
252
  main()
253
 
 
235
  layout=go.Layout(
236
  updatemenus=[{
237
  'type':'buttons',
238
+ # Streamlit's dark mode erases the text from this button
239
+ # but it shows up in light mode
240
+ # also, st.button() buttons show up fine in dark mode
241
+
242
+ # Trying some of these to see whether I can get the button text to show up
243
+ # https://plotly.com/python/reference/layout/updatemenus/
244
+
245
+ # this doesn't have any effect
246
+ # in either light or dark mode
247
+ # `fill` value is rgb(244, 250, 255) still
248
+ # when I change this, the browser debugger says that the <text> tag is updating
249
+ # not the surrounding <rect>
250
+ # also there isn't any change in the <text> tag, it just updates
251
+ 'bgcolor': '#00f',
252
+
253
+ # This does make the text show up so that's good
254
+ 'font': {'color': '#639'},
255
+ # And this one works too
256
+ 'bordercolor': '#f7b',
257
+
258
+ # set all buttons to inactive
259
+ # to see whether that gives them all bgcolor
260
+ # yep that works
261
+ #'active': -1,
262
+
263
+ # Or set showactive to False?
264
+ # Also works
265
+ 'showactive': False,
266
+
267
+ # they always flash white on mouseover though
268
+ # I'm not sure I can change that behavior
269
+
270
+ # The actual html "style" text in the page changes when I mouseover the elements
271
+ # which makes me think it's not something I can affect
272
+
273
  'buttons':[{
274
  'label':'Play',
275
  'method': 'animate',
276
  'args':[None, {
277
  'frame': {'duration':5000},
278
+ 'transition': {'duration': 2500},
279
+ }],
280
+ },
281
+ # Now this one gets the bgcolor
282
+ # and if I click it then the other button gets
283
+ # the bgcolor
284
+ # so a button only gets bgcolor if it's not "active"
285
+ {'label': 'Button 2', 'method':'skip'}
286
+ ]
287
  }]
288
  )
289
  )
290
  st.plotly_chart(ani_fig)
291
 
292
+
293
  if __name__=='__main__':
294
  main()
295