Textualize / textual

The lean application framework for Python. Build sophisticated user interfaces with a simple Python API. Run your apps in the terminal and a web browser.
https://textual.textualize.io/
MIT License
25.78k stars 798 forks source link

Visual glitch while switching radio buttons #4785

Open jakubziebin opened 4 months ago

jakubziebin commented 4 months ago

Hello, We have a problem with the RadioButtons buttons located in the RadioSet. When switching the buttons, sometimes the situation with the video appears. issue_textual.webm Unfortunately, it is not possible to reproduce the problem with MRE (or it is so difficult). We do a workaround for this problem by adding a refresh call in the watch__selected method. Workaround code:

class MyRadioSet(RadioSet):
    def watch__selected(self) -> None:
        super().watch__selected()
        self.refresh(layout=True)

Textual diagnose:

# Textual Diagnostics

## Versions

| Name    | Value  |
|---------|--------|
| Textual | 0.73.0 |
| Rich    | 13.7.0 |

## Python

| Name           | Value                                                  |
|----------------|--------------------------------------------------------|
| Version        | 3.10.6                                                 |
| Implementation | CPython                                                |
| Compiler       | GCC 11.4.0                                             |
| Executable     | /home/dev/.pyenv/versions/3.10.6/envs/clive/bin/python |

## Operating System

| Name    | Value                                                            |
|---------|------------------------------------------------------------------|
| System  | Linux                                                            |
| Release | 6.5.0-44-generic                                                 |
| Version | #44~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Jun 18 14:36:16 UTC 2 |

## Terminal

| Name                 | Value          |
|----------------------|----------------|
| Terminal Application | GNOME Terminal |
| TERM                 | xterm-256color |
| COLORTERM            | truecolor      |
| FORCE_COLOR          | *Not set*      |
| NO_COLOR             | *Not set*      |

## Rich Console options

| Name           | Value                |
|----------------|----------------------|
| size           | width=133, height=43 |
| legacy_windows | False                |
| min_width      | 1                    |
| max_width      | 133                  |
| is_terminal    | True                 |
| encoding       | utf-8                |
| max_height     | 43                   |
| justify        | None                 |
| overflow       | None                 |
| no_wrap        | False                |
| highlight      | None                 |
| markup         | None                 |
| height         | None                 |
willmcgugan commented 4 months ago

@jakubziebin Without an MRE it is going to be difficult to diagnose.

I see you are doing some kind of customization, can you at least let us know what you changed over the defaults?

jakubziebin commented 2 months ago

Sorry for the late reply. I customizied radio-button:

class CustomRadioButton(RadioButton):
    """Due to bug in Ubuntu we have to replace icon of the RadioButton by simple 'O'."""

    BUTTON_INNER = "O"

and the radio set adjusted as I sent it. Unfortunately, I can't reproduce this with the MRE.

willmcgugan commented 1 month ago

I can't reproduce this. Can you share the code you are using to create and modify the radio set?