70 lines
1.6 KiB
Plaintext
70 lines
1.6 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"id": "ebaa184b-765f-4261-9c5c-285bbde8fad5",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"application/vnd.jupyter.widget-view+json": {
|
|
"model_id": "dfda01818965434d8417413b6c2020d5",
|
|
"version_major": 2,
|
|
"version_minor": 0
|
|
},
|
|
"text/plain": [
|
|
"VBox(children=(HBox(children=(Button(description='1', style=ButtonStyle()), Button(description='2', style=Butt…"
|
|
]
|
|
},
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"import ipywidgets as widgets\n",
|
|
"def generate(n):\n",
|
|
" widget = []\n",
|
|
" for i in range(n):\n",
|
|
" inner = []\n",
|
|
" for j in range(n):\n",
|
|
" inner.append(widgets.Button(description=f'{i*n+j+1}'))\n",
|
|
" widget.append(widgets.HBox(inner))\n",
|
|
"\n",
|
|
" return widgets.VBox(widget)\n",
|
|
"generate(20)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "8b59589a-7c71-4b1a-896a-b1139cbcf70f",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3 (ipykernel)",
|
|
"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.10.8"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|