Skip to content

Add support for Drawer UI component#14081

Merged
mattpap merged 6 commits into
branch-3.7from
mattpap/drawer
Oct 1, 2024
Merged

Add support for Drawer UI component#14081
mattpap merged 6 commits into
branch-3.7from
mattpap/drawer

Conversation

@mattpap
Copy link
Copy Markdown
Contributor

@mattpap mattpap commented Sep 25, 2024

Screencast.from.2024-09-25.18-20-13.webm
Code
import numpy as np

from bokeh.models import Drawer, Examiner
from bokeh.plotting import figure, show

N = 4000
x = np.random.random(size=N) * 100
y = np.random.random(size=N) * 100
radii = np.random.random(size=N) * 1.5
colors = np.array([(r, g, 150) for r, g in zip(50+2*x, 30+2*y)], dtype="uint8")

plot = figure()
plot.circle(x, y, radius=radii, fill_color=colors, fill_alpha=0.6, line_color=None)

examiner = Examiner(target=plot)
drawer = Drawer(location="right", resizable=True, elements=[examiner])

show([plot, drawer])

@bryevdv
Copy link
Copy Markdown
Member

bryevdv commented Sep 25, 2024

Is there an associated issue that describes the motivation and goals for this element? We might also want a place to discuss naming. I am not sure about "Drawer" I came here half expecting a drawing tool of some sort.

@mattpap
Copy link
Copy Markdown
Contributor Author

mattpap commented Sep 25, 2024

There is no issue for this as far as I can tell. The motivation is to build up a set of commonly used UI components, similarly to progress widgets, etc. Drawer is a common name, but it is up to discussion.

@mattpap
Copy link
Copy Markdown
Contributor Author

mattpap commented Sep 25, 2024

This also works when attaching the Drawer to other elements, like a Plot:

Screencast.from.2024-09-26.01-02-02.webm

Change the original example to:

plot.elements.append(drawer)
show(plot)

@mattpap mattpap added the tag: UI: components New or improvements to existing UI components. label Sep 26, 2024
@mattpap mattpap changed the base branch from branch-3.6 to branch-3.7 September 26, 2024 16:35
@mattpap mattpap force-pushed the mattpap/drawer branch 3 times, most recently from 783c21c to 887e7ac Compare September 28, 2024 09:07
Copy link
Copy Markdown
Member

@bryevdv bryevdv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a few comments

Comment thread src/bokeh/io/showing.py
Comment thread src/bokeh/models/ui/floating.py
Comment thread tests/unit/bokeh/io/test_showing.py Outdated
@mattpap mattpap merged commit ad1b2ca into branch-3.7 Oct 1, 2024
@mattpap mattpap deleted the mattpap/drawer branch October 1, 2024 08:52
@github-actions
Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jan 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants