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
Copy file name to clipboardExpand all lines: docs/source/examples/Widget Events.ipynb
+8-44Lines changed: 8 additions & 44 deletions
Original file line number
Diff line number
Diff line change
@@ -124,63 +124,27 @@
124
124
}
125
125
},
126
126
"source": [
127
-
"### on_submit"
128
-
]
129
-
},
130
-
{
131
-
"cell_type": "markdown",
132
-
"metadata": {},
133
-
"source": [
134
-
"The `Text` widget also has a special `on_submit` event. The `on_submit` event fires when the user hits return."
135
-
]
136
-
},
137
-
{
138
-
"cell_type": "code",
139
-
"execution_count": 4,
140
-
"metadata": {},
141
-
"outputs": [
142
-
{
143
-
"data": {
144
-
"application/vnd.jupyter.widget-view+json": {
145
-
"model_id": "cab0a6538a00491f95c48e77707e9ad8"
146
-
}
147
-
},
148
-
"metadata": {},
149
-
"output_type": "display_data"
150
-
}
151
-
],
152
-
"source": [
153
-
"text = widgets.Text()\n",
154
-
"display(text)\n",
155
-
"\n",
156
-
"def handle_submit(sender):\n",
157
-
" print(text.value)\n",
158
-
"\n",
159
-
"text.on_submit(handle_submit)"
127
+
"## Traitlet events"
160
128
]
161
129
},
162
130
{
163
131
"cell_type": "markdown",
164
132
"metadata": {
165
-
"slideshow": {
166
-
"slide_type": "slide"
167
-
}
133
+
"deletable": true,
134
+
"editable": true
168
135
},
169
-
"source": [
170
-
"## Traitlet events"
171
-
]
172
-
},
173
-
{
174
-
"cell_type": "markdown",
175
-
"metadata": {},
176
136
"source": [
177
137
"Widget properties are IPython traitlets and traitlets are eventful. To handle changes, the `observe` method of the widget can be used to register a callback. The doc string for `observe` can be seen below."
0 commit comments