| 1 | from pytermgui import Button, Container, pretty, tim |
| 2 | |
| 3 | template = "[@primary #auto] {first} [@surface-1 #auto] {second} " |
| 4 | |
| 5 | |
| 6 | def split_style(_: int, item: str) -> str: |
| 7 | if "<SPLIT>" not in item: |
| 8 | return item |
| 9 | |
| 10 | first, second = item.split("<SPLIT>") |
| 11 | return tim.parse(template.format(first=first, second=second)) |
| 12 | |
| 13 | |
| 14 | Button.styles.label = split_style |
| 15 | Button.set_char("delimiter", [""] * 2) |
| 16 | my_button = Button("Hey<SPLIT>There") |
| 17 | |
| 18 | pretty.print(my_button) |