{"id":31801079,"url":"https://github.com/amiralimollaei/pybud-gui","last_synced_at":"2025-10-10T23:24:40.254Z","repository":{"id":232950469,"uuid":"785626936","full_name":"amiralimollaei/pybud-gui","owner":"amiralimollaei","description":"A python library for creating beautiful GUIs in console, optimized with a Rust backend, with tons of different modules, such as Drawer, Session, Windows, Widgets, and many more!","archived":false,"fork":false,"pushed_at":"2025-07-30T21:03:16.000Z","size":733,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-18T04:54:31.043Z","etag":null,"topics":["ansi","console","console-application","console-framework","library","pip","python","python3","rust","terminal","terminal-app","terminal-based"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amiralimollaei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-12T09:21:43.000Z","updated_at":"2025-03-04T21:58:10.000Z","dependencies_parsed_at":"2024-12-26T11:32:30.207Z","dependency_job_id":"0ebf49f8-8f5f-4035-ad88-cd12219a6e66","html_url":"https://github.com/amiralimollaei/pybud-gui","commit_stats":null,"previous_names":["amirali1059/pybud-gui","amiralimollaei/pybud-gui"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/amiralimollaei/pybud-gui","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiralimollaei%2Fpybud-gui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiralimollaei%2Fpybud-gui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiralimollaei%2Fpybud-gui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiralimollaei%2Fpybud-gui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amiralimollaei","download_url":"https://codeload.github.com/amiralimollaei/pybud-gui/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiralimollaei%2Fpybud-gui/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005560,"owners_count":26083919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansi","console","console-application","console-framework","library","pip","python","python3","rust","terminal","terminal-app","terminal-based"],"created_at":"2025-10-10T23:24:37.467Z","updated_at":"2025-10-10T23:24:40.247Z","avatar_url":"https://github.com/amiralimollaei.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyBUD: Python Beauty\n\n[![CodeFactor](https://www.codefactor.io/repository/github/amiralimollaei/pybud-gui/badge)](https://www.codefactor.io/repository/github/amiralimollaei/pybud-gui) [![PyPI](https://img.shields.io/pypi/v/pybud-gui.svg)](https://pypi.org/project/pybud-gui/)\n\n**A python library for creating beautiful GUIs in console, optimized with a Rust backend, with tons of different modules, such as `Drawer`, `Session`, `Window`s, `Widget`s, and many more!**\n\n![PyBUD](https://raw.githubusercontent.com/amiralimollaei/pybud-gui/main/images/pybud.gif)\n\n---\n\n## Installation\n\nto install using pip:\n\n```bash\npip install pybud-gui -U\n```\n\nor if you want to install from source:\n\n```bash\npip install git+https://github.com/amiralimollaei/pybud-gui.git\n```\n\n## Documentation\n\n### Table of Contents\n\n- [Build Your First Window](#build-your-first-window)\n- [Add Your First Widget](#add-your-first-widget)\n- [ComboBox Example](#combobox-example)\n- [TextBox Example](#textbox-example)\n- [Advanced Example 1](#advanced-example-1)\n- [Advanced Example 2](#advanced-example-2)\n\n---\n\n### Build Your First Window\n\nFirst import modules:\n\n```python\nfrom pybud.session import Session\nfrom pybud.window import Window\n```\n\nYou can think of `Session` as a display monitor, the display has a refresh rate (`session.TPS`) and size (`datatypes.Size`), and can show multiple `Window`s on it.\n\nNext, build the main class:\n\n```python\nclass Main(Window):\n    def __init__(self):\n        super().__init__(\n            size = (100, 10),\n            position = (0, 0),\n            title = \"Window Example\",\n        )\n```\n\nAnd finally, show the window:\n\n```python\n# only for windows users\nimport pybud.drawer.ansi as ansi\nansi.init()\n\n# add `Main` to session and show\ns = Session((100, 10), background=(100, 100, 250))\ns.add_window(Main())\ns.show()\n```\n\nOutput:\n\n\u003e ![Build Your First Window](https://raw.githubusercontent.com/amiralimollaei/pybud-gui/main/images/build-your-first-window.png)\n\n### Add Your First Widget\n\nFirst import modules:\n\n```python\nfrom pybud.session import Session\nfrom pybud.window import Window\nfrom pybud.widgets import Label\n# using `ansi` module you can define colored text with graphics\nfrom pybud.drawer import ansi\n```\n\nNext, build the Main class just like above, but add a `Label` widget.\n\n```python\n# build the main window\nclass Main(Window):\n    def __init__(self):\n        super().__init__(\n            size = (50, 9),\n            position = (0, 0),\n            title = \"Colored Text Example\",\n        )\n\n        # add a label widget, set text, width and position\n        self.add_widget(Label(\n            # define a ansi.AnsiString object that renders text with colors\n            # you can set both forecolor and backcolor\n            text = ansi.AnsiString(\"Hello world!\", fore = (90, 250, 90)),\n            position = (19, 4),\n            size = (60, 1)\n            )\n        )\n```\n\nAnd finally, show the window:\n\n```python\n# only for windows users\nimport pybud.drawer.ansi as ansi\nansi.init()\n\n# add `Main` to session and show\ns = Session((50, 9), background=(100, 100, 250))\ns.add_window(Main())\ns.show()\n```\n\nOutput:\n\u003e![Add Your First Widget](https://raw.githubusercontent.com/amiralimollaei/pybud-gui/main/images/add-your-first-widget.png)\n\n### ComboBox Example\n\nFirst import modules:\n\n```python\nfrom pybud.session import Session\nfrom pybud.window import Window\nfrom pybud.widgets import ComboBox\n```\n\nNext, build the Main class and add a `ComboBox` widget.\n\n```python\nclass Main(Window):\n    def __init__(self):\n        super().__init__(\n            size = (50, 9),\n            position = (0, 0),\n            title = \"ComboBox Example\",\n        )\n\n        self.add_widget(ComboBox(\n            text = \"Choose an option: \",\n            options = {\n                \"Option 1\": self.option1,\n                \"Option 2\": self.option2,\n                \"Option 3\": self.option3,\n            },\n            size = (40, 1),\n            position = (5, 4),\n        ))\n\n    def option1(self):\n        print(\"Option 1 selected\")\n\n    def option2(self):\n        print(\"Option 2 selected\")\n\n    def option3(self):\n        print(\"Option 3 selected\")\n```\n\nAnd finally, show the window:\n\n```python\n# only for windows users\nimport pybud.drawer.ansi as ansi\nansi.init()\n\n# add `Main` to session and show\ns = Session((50, 9), background=(100, 100, 250))\ns.add_window(Main())\ns.show()\n```\n\nOutput:\n\u003e![ComboBox Example](https://raw.githubusercontent.com/amiralimollaei/pybud-gui/main/images/combobox-example.png)\n\n### Advanced Example 1\n\nFirst import modules:\n\n```python\nfrom pybud.session import Session\nfrom pybud.window import Window\nfrom pybud.widgets import VerticalMultipleChoice\nfrom pybud.drawer import ansi\n```\n\nNext, build the Main class and add a `VerticalMultipleChoice` widget.\n\n```python\nclass Main(Window):\n    def __init__(self):\n        super().__init__(\n            size = (76, 11),\n            position = (0, 0),\n            title = \"Vertical Multiple Choice Example\"\n        )\n        \n        self.add_widget(VerticalMultipleChoice(\n            text = ansi.AnsiString(\"Choose an option: \", fore=(150, 250, 50)),\n            options = {\n                \"Nice!\": self.nice_option,\n                \"Very Good!\": self.verygood_option,\n                \"Brilliant!\": self.brilliant_option,\n            },\n            default_option = 2,\n            size = (self.size.width - 4, 1),\n            position = (2, 5),\n        ))\n        self.lbl_result = Label(\n            \"\",\n            centered = True,\n            size = (self.size.width - 2, 1),\n            position = (1, 9),\n        )\n        self.add_widget(self.lbl_result)\n\n    def brilliant_option(self):\n        self.lbl_result.text = ansi.AnsiString(\"Brilliant!\", fore=(0, 255, 0))\n\n    def verygood_option(self):\n        self.lbl_result.text = ansi.AnsiString(\"Very Good!\", fore=(255, 0, 0))\n\n    def nice_option(self):\n        self.lbl_result.text = ansi.AnsiString(\"Nice!\", fore=(0, 0, 255))\n```\n\nAnd finally, show the window:\n\n```python\n# only for windows users\nimport pybud.drawer.ansi as ansi\nansi.init()\n\n# add `Main` to session and show\ns = Session((76, 11), background=(90, 110, 220))\ns.add_window(Main())\ns.show()\n```\n\nOutput:\n\u003e![Vertical Multiple Choice Example](https://raw.githubusercontent.com/amiralimollaei/pybud-gui/main/images/advanced-example-1.png)\n\n### TextBox Example\n\nFirst import modules:\n\n```python\nfrom pybud.session import Session\nfrom pybud.window import Window\nfrom pybud.widgets import TextBox\n```\n\nNext, build the Main class and add a `TextBox` widget.\n\n```python\nclass Main(Window):\n    def __init__(self):\n        super().__init__(\n            size = (50, 9),\n            position = (0, 0),\n            title = \"TextBox Example\",\n        )\n\n        self.add_widget(TextBox(\n            text = \"Enter text: \",\n            size = (40, 1),\n            position = (5, 4),\n        ))\n```\n\nAnd finally, show the window:\n\n```python\n# only for windows users\nimport pybud.drawer.ansi as ansi\nansi.init()\n\n# add `Main` to session and show\ns = Session((50, 9), background=(100, 100, 250))\ns.add_window(Main())\ns.show()\n```\n\nOutput:\n\u003e![TextBox Example](https://raw.githubusercontent.com/amiralimollaei/pybud-gui/main/images/textbox-example.png)\n\n### Advanced Example 2\n\nFirst import modules:\n\n```python\nfrom pybud.drawer import ansi\nfrom pybud.session import Session\nfrom pybud.window import Window\nfrom pybud.widgets import TextBox, Label, ComboBox, VerticalMultipleChoice\n```\n\nNext, build the Main class and add multiple widgets.\n\n```python\nclass Main(Window):\n    def __init__(self):\n        super().__init__(\n            size = (76, 14),\n            position = (0, 0),\n            has_border = False,\n            opacity = 1.0,\n            title = \"PyBUD: GUI Beauty\"\n        )\n        \n        title = ansi.AnsiString(\"PyBUD: GUI Beauty\", fore = (20, 250, 120))\n        title.add_graphics(ansi.AnsiGraphicMode.BOLD | ansi.AnsiGraphicMode.UNDERLINE)\n        \n        title = ansi.AnsiString(\"[ \") + title + ansi.AnsiString(\" ]\")\n\n        self.add_widget(Label(\n            title,\n            centered = True,\n            size = (self.size.width - 4, 1),\n            position = (2, 1),\n        ))\n        \n        caption = \"A python library for creating beautiful GUIs in console, with tons of different components, such as Dialogs, Widgets, Drawables, ansi color optimizations written in Rust, and more!\"\n        \n        self.add_widget(Label(\n            caption,\n            centered = True,\n            size = (self.size.width - 4, 1),\n            position = (2, 2),\n        ))\n        self.add_widget(TextBox(\n            \"TextBox: \",\n            size = (self.size.width//2 - 4, 1),\n            position = (2, 6),\n        ))\n        self.add_widget(ComboBox(\n            \"ComboBox: \",\n            options = {\n                \"Nice!\": self.nice_option,\n                \"Very Good!\": self.verygood_option,\n                \"Awesome!\": self.awesome_option,\n                \"Brilliant!\": self.brilliant_option,\n            },\n            size = (self.size.width//2 - 4, 1),\n            position = (self.size.width//2 + 2, 6),\n        ))\n        self.add_widget(VerticalMultipleChoice(\n            \"VerticalMultipleChoice:\",\n            options = {\n                \"Nice!\": self.nice_option,\n                \"Very Good!\": self.verygood_option,\n                \"Awesome!\": self.awesome_option,\n                \"Brilliant!\": self.brilliant_option,\n            },\n            size = (self.size.width-4, 1),\n            position = (2, 8),\n        ))\n        self.add_widget(Label(\n            ansi.AnsiString(\"Tip: \", fore = (255, 128, 0)) +\n            ansi.AnsiString(\"Use TAB or arrow keys to switch between Widgets, Use \") +\n            ansi.AnsiString(\"Ctrl + C\", fore = (255, 128, 0)) + ansi.AnsiString(\" to exit the demo.\"),\n            centered = True,\n            size = (self.size.width - 26, 1),\n            position = (22, 9),\n            name = \"tip-label\"\n        ))\n        self.lbl_result = Label(\n            \"\",\n            centered = True,\n            size = (self.size.width - 4, 1),\n            position = (2, 12),\n            name = \"result-label\"\n        )\n        self.add_widget(self.lbl_result)\n\n    def brilliant_option(self):\n        self.lbl_result.text = \"Brilliant!\"\n\n    def verygood_option(self):\n        self.lbl_result.text = \"Very Good!\"\n\n    def nice_option(self):\n        self.lbl_result.text = \"Nice!\"\n\n    def awesome_option(self):\n        self.lbl_result.text = \"Awesome!\"\n```\n\nAnd finally, show the window:\n\n```python\n# only for windows users\nimport pybud.drawer.ansi as ansi\nansi.init()\n\n# add `Main` to session and show\nmain_window = Main()\ns = Session((76, 14), background=(90, 110, 220))\ns.add_window(main_window)\ns.show()\n\nprint(f\"Session Closed! Widget Data:\\n\")\nfor i, w in enumerate(main_window._widgets):\n    print(w.name + \":\")\n    if isinstance(w, TextBox):\n        print(f\"- text=\\\"{w.text}\\\", input=\\\"{w.input}\\\"\")\n    elif isinstance(w, (VerticalMultipleChoice, ComboBox)):\n        print(f\"- selected_option_id={w.selected_option_id}\")\n        print(f\"- selected option text=\\\"{list(w.options)[w.selected_option_id]}\\\"\")\n    if isinstance(w, Label):\n        print(f\"- text=\\\"{w.text}\\\"\")\n    else:\n        print(\"- no data\")\n    print(\"\")\n```\n\nOutput:\n\u003e![Advanced Example 2](https://raw.githubusercontent.com/amiralimollaei/pybud-gui/main/images/advanced-example-2.png)\n\n---\n\nLicense: `BSD 4-clause License`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famiralimollaei%2Fpybud-gui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famiralimollaei%2Fpybud-gui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famiralimollaei%2Fpybud-gui/lists"}