Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docking and auto sizing #5363

Closed
TryMyWagon opened this issue Dec 9, 2024 · 1 comment
Closed

docking and auto sizing #5363

TryMyWagon opened this issue Dec 9, 2024 · 1 comment

Comments

@TryMyWagon
Copy link

child widgets of a parent widget docked to the right side of the screen still try to default to the left and will try to "magnetize" as far left as possible (as far as allowed by the parent widgets max-width: value).

Using auto scaling in the parent widget causes the child widgets snap back to the left and stretch the parent container across the entire view

attempting to align the runaway widget to the right side (via the parent) does not fix the parent containers auto scaling being stretched

This is using the most recent src including the merge made last night (#5360)

test code;

from rich.console import Console
from rich.traceback import install

install()

from rich import pretty

pretty.install()

from textual.app import App
from textual.widgets import Button, Static


# buttons inside the sidebar
class StartButtons(Static):
    def compose(self):
        yield Button("Placeholder", variant="primary", id="p1")
        yield Button("Placeholder", variant="error", id="p2")


# sidebar widget
class Sidebar(Static):
    def compose(self):
        yield StartButtons()


# side container
class SideContainer(Static):
    def compose(self):
        yield Sidebar()


# Main app
class Test4(App):
    DEFAULT_CSS = """
    StartButtons {
        background: yellow;

        align-horizontal: center;
    }
    SideContainer {
        dock: right;

        height: 99%;
        width: 99%;

        background: red;

        # max-width: 60;
        # align-horizontal: right;
    }
    Sidebar {
        min-width: 30;
        height: 20;
        width: 20;

        background: blue;
        border: double green;

    }
    """

    BINDINGS = [
        ("q", "quit", "Quit"),
    ]

    def compose(self):
        yield SideContainer()

    def action_quit(self):
        self.exit()


# run
if __name__ == "__main__":
    Test4().run()
# Textual Diagnostics

## Versions

| Name    | Value  |
|---------|--------|
| Textual | 0.88.1 |
| Rich    | 13.9.4 |

## Python

| Name           | Value                                                                                                            |
|----------------|------------------------------------------------------------------------------------------------------------------|
| Version        | 3.12.1                                                                                                           |
| Implementation | CPython                                                                                                          |
| Compiler       | MSC v.1937 64 bit (AMD64)                                                                                        |
| Executable     | C:\Users\Miles\Documents\!Programs(LOCAL)\!Projects\(python) TwitchOW2PredictionBot\src\.venv\Scripts\python.exe |

## Operating System

| Name    | Value      |
|---------|------------|
| System  | Windows    |
| Release | 10         |
| Version | 10.0.19045 |

## Terminal

| Name                 | Value           |
|----------------------|-----------------|
| Terminal Application | vscode (1.95.3) |
| TERM                 | *Not set*       |
| COLORTERM            | truecolor       |
| FORCE_COLOR          | *Not set*       |
| NO_COLOR             | *Not set*       |

## Rich Console options

| Name           | Value                |
|----------------|----------------------|
| size           | width=204, height=25 |
| legacy_windows | False                |
| min_width      | 1                    |
| max_width      | 204                  |
| is_terminal    | True                 |
| encoding       | utf-8                |
| max_height     | 25                   |
| justify        | None                 |
| overflow       | None                 |
| no_wrap        | False                |
| highlight      | None                 |
| markup         | None                 |
| height         | None                 |
Copy link

github-actions bot commented Dec 9, 2024

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@Textualize Textualize locked and limited conversation to collaborators Dec 9, 2024
@willmcgugan willmcgugan converted this issue into discussion #5364 Dec 9, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant