{"id":19313789,"url":"https://github.com/mingrammer/python-curses-scroll-example","last_synced_at":"2025-04-22T16:31:28.528Z","repository":{"id":46858534,"uuid":"123765386","full_name":"mingrammer/python-curses-scroll-example","owner":"mingrammer","description":":tv: How to implement the scroll and paging in Python curses","archived":false,"fork":false,"pushed_at":"2021-09-22T15:51:52.000Z","size":11,"stargazers_count":47,"open_issues_count":3,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-02-29T16:32:11.522Z","etag":null,"topics":["curses","example","paging","python","scroll"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mingrammer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-04T07:06:12.000Z","updated_at":"2024-02-13T18:35:29.000Z","dependencies_parsed_at":"2022-07-25T00:02:04.906Z","dependency_job_id":null,"html_url":"https://github.com/mingrammer/python-curses-scroll-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mingrammer%2Fpython-curses-scroll-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mingrammer%2Fpython-curses-scroll-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mingrammer%2Fpython-curses-scroll-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mingrammer%2Fpython-curses-scroll-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mingrammer","download_url":"https://codeload.github.com/mingrammer/python-curses-scroll-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223900316,"owners_count":17222028,"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","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":["curses","example","paging","python","scroll"],"created_at":"2024-11-10T00:41:09.061Z","updated_at":"2024-11-10T00:41:09.531Z","avatar_url":"https://github.com/mingrammer.png","language":"Python","readme":"# Python Curses Scroll Example\n\nI'll introduce how to implement the scroll and paging in Python curses.\n\n## What is purpose?\n\nScroll and paging are little a bit cumbersome to implement with curses. So, I'd like to share the code snippets to help for building the scroll and paging feature for your TUI based application.\n\n## Key Idea\n\nThe key idea is simple. The idea is that compare the length of item list and current cursor position, then just calculate the next cursor position. Of course, there are some exceptions such as scroll overflow we must deal with.\n\n## Run \u0026 Test\n\nClone this repository and run `python3 tui.py`\n\n\u003e It supports Python 3+ only. With Python 2, It might not be work correctly.\n\n* Scroll\n  * KEY_UP (↑) for scroll up\n  * KEY_DOWN (↓) for scroll down\n* Paging\n  * KEY_LEFT (←) for page up\n  * KEY_RIGHT (→) for page down\n\n## Scroll Demo\n\n[Scroll implementation](/tui.py#L86-L110)\n\n[![Scroll In Python Curses](https://asciinema.org/a/166994.png)](https://asciinema.org/a/166994)\n\n## Paging Demo\n\n[Paging implementation](/tui.py#L112-L132)\n\n[![Paging In Python Curses](https://asciinema.org/a/166995.png)](https://asciinema.org/a/166995)\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmingrammer%2Fpython-curses-scroll-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmingrammer%2Fpython-curses-scroll-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmingrammer%2Fpython-curses-scroll-example/lists"}