| 1 | import pytermgui as ptg |
| 2 | |
| 3 | ptg.boxes.ROUNDED.set_chars_of(ptg.Container) |
| 4 | ptg.Splitter.set_char("separator", " ") |
| 5 | |
| 6 | width, height = ptg.get_terminal().size |
| 7 | |
| 8 | with ptg.YamlLoader() as loader: |
| 9 | loader.load( |
| 10 | """ |
| 11 | config: |
| 12 | Window: |
| 13 | styles: |
| 14 | border: '60' |
| 15 | corner: '60' |
| 16 | |
| 17 | Container: |
| 18 | styles: |
| 19 | border: '96' |
| 20 | corner: '96' |
| 21 | """ |
| 22 | ) |
| 23 | |
| 24 | |
| 25 | showcase = ptg.Window( |
| 26 | ptg.Label("Welcome to [bold !gradient(210)]PyTermGUI[/]!\n"), |
| 27 | ptg.Splitter( |
| 28 | ptg.Container(ptg.Label("This is the box on the left")), |
| 29 | ptg.Container(ptg.Label("This is the box in the middle")), |
| 30 | ptg.Container(ptg.Label("This is the box on the right")), |
| 31 | ), |
| 32 | ptg.Label("\nHere are some interactive elements:"), |
| 33 | ptg.Container( |
| 34 | ptg.Splitter( |
| 35 | ptg.Label("Checkboxes", parent_align=0), ptg.Checkbox(parent_align=2) |
| 36 | ), |
| 37 | ptg.Splitter( |
| 38 | ptg.Label("Buttons", parent_align=0), ptg.Button("Button 1", parent_align=2) |
| 39 | ), |
| 40 | ptg.Splitter(ptg.Label("Sliders", parent_align=0), ptg.Slider(parent_align=2)), |
| 41 | relative_width=2 / 3, |
| 42 | ), |
| 43 | width=width, |
| 44 | box="DOUBLE", |
| 45 | ) |
| 46 | |
| 47 | with ptg.WindowManager() as manager: |
| 48 | manager.layout.add_slot() |
| 49 | manager.add(showcase) |