{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# ipyregulartable\n", "https://github.com/finos/ipyregulartable\n", " " ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import ipyregulartable as rt\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "3dddacf0a1eb49d28af6e8235c93f32e", "version_major": 2, "version_minor": 0 }, "text/plain": [ "RegularTableWidget()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "w = rt.RegularTableWidget(rt.NumpyDataModel(np.random.random((10, 10))))\n", "w" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "c58d812f355b46478c6162e94d9d5915", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Output()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import ipywidgets as ipy\n", "out = ipy.Output()\n", "out" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "def on_edit(widget, coords_and_value):\n", " with out:\n", " print(\"edited: ({},{})->{}\".format(coords_and_value[0],\n", " coords_and_value[1],\n", " coords_and_value[2]))\n", " \n", "w.on_edit(on_edit)\n", " " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.7" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": { "028406b980034f28b57dabb08327b8df": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": {} }, "3dddacf0a1eb49d28af6e8235c93f32e": { "model_module": "ipyregulartable", "model_module_version": "^0.1.2", "model_name": "RegularTableModel", "state": { "_data": { "column_headers": [ [ "0" ], [ "1" ], [ "2" ], [ "3" ], [ "4" ], [ "5" ], [ "6" ], [ "7" ], [ "8" ], [ "9" ], [ "10" ] ], "data": [ [ 0.16777258472454415, 0.856698851666498, 0.17823948697099512, 0.6956063139390736, 0.5982975261250694, 0.1878465806466072, 0.17410325946300365, 0.26450356846477885, 0.22310107597631224, 0.009397992115766418 ], [ 0.412007535340817, 0.01874704350247769, 0.06086784172740223, 0.4486180538710185, 0.11862364703831974, 0.37975016351577306, 0.9736979093825255, 0.14880376619458913, 0.6403120334903659, 0.21716942414704143 ], [ 0.8346033050281617, 0.4946572759029114, 0.36131660598863, 0.31968360090165526, 0.29660795159872877, 0.731975341494576, 0.8176930151283262, 0.6088387111304903, 0.2761590226043833, 0.6347304602691898 ], [ 0.47017052714889906, 0.8748251042736778, 0.05035744548578447, 0.6676652407779304, 0.3240714219246318, 0.9204186375054568, 0.1900529654101083, 0.7247192671334599, 0.24568284358060755, 0.19467127582338584 ], [ 0.9336929465558712, 0.4677509957755335, 0.2989873774027286, 0.30117751588979635, 0.494333374369029, 0.09286945096866672, 0.5956079741164083, 0.528276252242528, 0.9968302246543538, 0.6953476759201932 ], [ 0.42292432324775464, 0.9239270957161614, 0.15344645005263902, 0.13761104189346052, 0.5544207992182826, 0.949444131594561, 0.1562339361799303, 0.3891236800910026, 0.29845806096715255, 0.18271924017828722 ], [ 0.19673564630065576, 0.6615768027920005, 0.8652552382364388, 0.9963029116304639, 0.5398197941546939, 0.011715690121416378, 0.27791189793621907, 0.21732984911174436, 0.47226530778973785, 0.9683727229033551 ], [ 0.38078908021012303, 0.38745880979201297, 0.5771695390069029, 0.8415190151513597, 0.5697287764128561, 0.9442712635149247, 0.09445669777554055, 0.46173982121805734, 0.44939195560414236, 0.28463114407002554 ], [ 0.008326911547219762, 0.5567145606954377, 0.6116317655274031, 0.721996158733827, 0.7116799689584064, 0.7078680166311034, 0.3759400773808498, 0.8283798803570497, 0.7057250739045429, 0.24046264706965337 ], [ 0.09702475186908321, 0.43489137805846767, 0.7738620055106267, 0.9904264859732405, 0.5239856434045587, 0.5232104765935123, 0.6151056473323981, 0.06901852257415031, 0.3175187459577802, 0.1579765082270158 ] ], "num_columns": 10, "num_rows": 10, "row_headers": [ [ "0" ], [ "1" ], [ "2" ], [ "3" ], [ "4" ], [ "5" ], [ "6" ], [ "7" ], [ "8" ], [ "9" ] ] }, "_editable": true, "_model_module_version": "^0.1.2", "_view_module_version": "^0.1.2", "css": {}, "height": 250, "layout": "IPY_MODEL_a8b598a12f614adba06a02650e13318a", "styler": {} } }, "a8b598a12f614adba06a02650e13318a": { "model_module": "@jupyter-widgets/base", "model_module_version": "1.2.0", "model_name": "LayoutModel", "state": {} }, "c58d812f355b46478c6162e94d9d5915": { "model_module": "@jupyter-widgets/output", "model_module_version": "1.0.0", "model_name": "OutputModel", "state": { "layout": "IPY_MODEL_028406b980034f28b57dabb08327b8df", "outputs": [ { "name": "stdout", "output_type": "stream", "text": "clicked: (1,5)->0.5\nclicked: (1,6)->45\nedited: (1,6)->45\n" } ] } } }, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 4 }