Split container with resizeable sections #4834
TomJGooding
started this conversation in
Ideas
Replies: 2 comments 1 reply
-
@TomJGooding thanks for posting this. I modified the separator slightly to set the margin to 0 and change the line style when it is dragged: class SplitContainerSeparator(Rule):
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
self.line_style = "hidden"
self.styles.margin = 0
self._grabbed = False
def on_mouse_down(self, event: events.MouseDown) -> None:
self._grabbed = True
def on_mouse_up(self, event: events.MouseUp) -> None:
self._grabbed = False
def on_leave(self, event: events.Leave) -> None:
if not self._grabbed:
self.line_style = "hidden"
def on_enter(self, event: events.Enter) -> None:
self.line_style = "thick" I also slightly simplified the container by just inheriting from class SplitContainer(Horizontal): Then you can remove the |
Beta Was this translation helpful? Give feedback.
0 replies
-
Nice! Needs a bit of polish (for example, how does it handle multiple splits at once?) But it's good progress! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is an idea that has been knocking around my head for a while.
I've attempted to create a proof of concept below. The new
SplitContainer
(name TBD!) would allow resizing sections with a draggable separator. This could also potentially also be nested inside another SplitContainer!Perhaps this would be better as an external package, but just posting this idea to see if there is any interest?
Beta Was this translation helpful? Give feedback.
All reactions