{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Linked widgets\n", "\n", "Widgets can be linked to compare between different surveys. Try moving one of the views and the others will follow!" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from ipyaladin import Aladin\n", "\n", "from ipywidgets import Layout, Box, widgets\n", "\n", "cosmetic_options = {\"show_projection_control\": False, \"show_fullscreen_control\": False}\n", "\n", "a = Aladin(layout=Layout(width=\"33.33%\"), target=\"M 81\", fov=0.3, **cosmetic_options)\n", "b = Aladin(layout=Layout(width=\"33.33%\"), survey=\"P/DSS2/red\", **cosmetic_options)\n", "c = Aladin(layout=Layout(width=\"33.33%\"), survey=\"P/2MASS/color\", **cosmetic_options)\n", "\n", "# synchronize target between 3 widgets\n", "widgets.jslink((a, \"_target\"), (b, \"_target\"))\n", "widgets.jslink((b, \"_target\"), (c, \"_target\"))\n", "\n", "# synchronize FoV (zoom level) between 3 widgets\n", "widgets.jslink((a, \"_fov\"), (b, \"_fov\"))\n", "widgets.jslink((b, \"_fov\"), (c, \"_fov\"))\n", "\n", "items = [a, b, c]\n", "\n", "box_layout = Layout(\n", " display=\"flex\", flex_flow=\"row\", align_items=\"stretch\", border=\"solid\", width=\"100%\"\n", ")\n", "box = Box(children=items, layout=box_layout)\n", "box" ] }, { "cell_type": "code", "execution_count": null, "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.11.3" } }, "nbformat": 4, "nbformat_minor": 4 }