Skip to content

Instantly share code, notes, and snippets.

@jdfreder
Created August 25, 2014 20:03
Show Gist options
  • Save jdfreder/cb24b3c14521088383d8 to your computer and use it in GitHub Desktop.
Save jdfreder/cb24b3c14521088383d8 to your computer and use it in GitHub Desktop.
cssstyletest
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"kernelspec": {
"codemirror_mode": {
"name": "python",
"version": 2
},
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"name": "",
"signature": "sha256:3f9c4495c76125121d4d203a243188cdeb1539dcbb344245d4305adb85008c58"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"from IPython.html import widgets\n",
"names = [n for n in dir(widgets) if not n.endswith('Widget') and n[0] == n[0].upper() and not n[0] == '_']\n",
"names"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 35,
"text": [
"['Accordion',\n",
" 'BoundedFloatText',\n",
" 'BoundedIntText',\n",
" 'Box',\n",
" 'Button',\n",
" 'CallbackDispatcher',\n",
" 'Checkbox',\n",
" 'Dropdown',\n",
" 'FlexBox',\n",
" 'FloatProgress',\n",
" 'FloatSlider',\n",
" 'FloatText',\n",
" 'HBox',\n",
" 'HTML',\n",
" 'Image',\n",
" 'IntProgress',\n",
" 'IntSlider',\n",
" 'IntText',\n",
" 'Latex',\n",
" 'Popup',\n",
" 'RadioButtons',\n",
" 'Select',\n",
" 'Tab',\n",
" 'Text',\n",
" 'Textarea',\n",
" 'ToggleButton',\n",
" 'ToggleButtons',\n",
" 'VBox']"
]
}
],
"prompt_number": 35
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from IPython.display import display\n",
"def try_widget(widget_type):\n",
" l = widgets.HTML(value=widget_type.__name__)\n",
" display(l)\n",
" \n",
" w = widget_type()\n",
" display(w)\n",
" w.font_family = 'Lucida Blackletter'\n",
" w.font_size = '30pt'\n",
" w.font_weight = 'lighter'\n",
" w.font_style = 'italic'\n",
" w.border_style = 'dotted'\n",
" w.border_width = '3px'\n",
" w.border_color = 'red'\n",
" w.back_color = '#009900'\n",
" w.fore_color = '#FFDD00'\n",
" w.width = 150\n",
" w.height = '50px'\n",
" w.description = 'this:'\n",
" try:\n",
" w.slider_color = 'purple'\n",
" except:\n",
" pass\n",
" try:\n",
" w.value = True\n",
" except:\n",
" pass\n",
" try:\n",
" w.values = ['Fancy', 'Not', 'Yes']\n",
" except:\n",
" pass\n",
" try:\n",
" w.value = 44\n",
" except:\n",
" pass\n",
" try:\n",
" w.value = 55.5\n",
" except:\n",
" pass\n",
" try:\n",
" w.value = 'Fancy'\n",
" except:\n",
" pass"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 11
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"[try_widget(getattr(widgets, name)) for name in names]"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"text": [
"<IPython.html.widgets.widget.CallbackDispatcher at 0x103c96b10>"
]
},
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 16,
"text": [
"[None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None,\n",
" None]"
]
}
],
"prompt_number": 16
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment