{"id":17603154,"url":"https://github.com/yjg30737/pyqt-translucent-full-loading-screen-thread","last_synced_at":"2025-09-08T03:31:35.575Z","repository":{"id":108706685,"uuid":"455021630","full_name":"yjg30737/pyqt-translucent-full-loading-screen-thread","owner":"yjg30737","description":"PyQt thread which overlays the translucent loading screen with label on the whole window like some generic application loading screen.","archived":false,"fork":false,"pushed_at":"2022-02-04T05:03:05.000Z","size":95,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-29T08:42:11.518Z","etag":null,"topics":["pyqt","pyqt-examples","pyqt-loading","pyqt-loading-screen","pyqt5","pyqt5-examples","pyqt5-tutorial","python","python3","python37","qlabel","qmovie","qt","qt-loading-screen","qthread","qtimer"],"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/yjg30737.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-03T03:50:33.000Z","updated_at":"2024-10-12T21:17:24.000Z","dependencies_parsed_at":"2023-04-09T05:17:29.889Z","dependency_job_id":null,"html_url":"https://github.com/yjg30737/pyqt-translucent-full-loading-screen-thread","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/yjg30737%2Fpyqt-translucent-full-loading-screen-thread","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2Fpyqt-translucent-full-loading-screen-thread/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2Fpyqt-translucent-full-loading-screen-thread/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2Fpyqt-translucent-full-loading-screen-thread/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yjg30737","download_url":"https://codeload.github.com/yjg30737/pyqt-translucent-full-loading-screen-thread/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232276151,"owners_count":18498383,"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":["pyqt","pyqt-examples","pyqt-loading","pyqt-loading-screen","pyqt5","pyqt5-examples","pyqt5-tutorial","python","python3","python37","qlabel","qmovie","qt","qt-loading-screen","qthread","qtimer"],"created_at":"2024-10-22T13:41:29.774Z","updated_at":"2025-01-03T01:23:36.942Z","avatar_url":"https://github.com/yjg30737.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyqt-translucent-full-loading-screen-thread\nPyQt thread which overlays the translucent loading screen with label on the whole window like some generic application loading screen.\n\n## Requirements\nPyQt5 \u003e= 5.8\n\n## Setup\n```pip3 install git+https://github.com/yjg30737/pyqt-translucent-full-loading-screen-thread.git --upgrade```\n\n## Usage\nThis package mainly consists of two classes. ```LoadingTranslucentScreen(parent: QWidget, description_text: str = '', dot_animation: bool = True)``` and ```LoadingThread(loading_screen: LoadingTranslucentScreen)```. I can show you how it works basically.\n```python\nself.loadingTranslucentScreen = LoadingTranslucentScreen(parent=self,\n                                                           description_text='Waiting...', dot_animation=False)\nself.thread = LoadingThread(loading_screen=self.loadingTranslucentScreen)\nself.thread.start()\n```\n\nJust give the parent widget to ```LoadingTranslucentScreen``` as a \u003cb\u003efirst argument\u003c/b\u003e. \n\n\u003cb\u003eSecond argument\u003c/b\u003e is description text of ```QLabel``` which will be shown with loading icon(loading icon is .gif extension, ```QMovie``` will get the gif loading icon) when you start the ```LoadingThread```. Defaut value is empty string.\n\n\u003cb\u003eThird argument\u003c/b\u003e(```dot_animation```) decides if triple dots animation of description text will operate or not. There is an explanation of triple dots animation feature below. Default value is True.\n\nGive instant of ```LoadingTranslucentScreen``` to ```LoadingThread```'s argument and call the start method of it. \n\nDefault ```run()``` task of this thread is ```time.sleep(5)```.\n\nYou can inherit this module and override run method.\n\nYou can use ```setDescriptionLabelDirection(direction: str)``` method of ```LoadingTranslucentScreen``` to set the direction of description label.\n\nIf thread starts running, dot animation will be activated. If the description text is 'Waiting', dot animation will be like below.\n```\nWaiting.\nWaiting..\nWaiting...\n```\nOf course this feature can reveal a couple of potential flaws if any dots are included in description text. I will fix that soon enough.\n\nValid argument is ```Left```, ```Right```, ```Top```, ```Bottom```. All of them should be ```str``` type.\n\nDefault direction is ```Bottom```.\n\nI show you how to use the method ```setDescriptionLabelDirection```.\n```python\nself.loadingTranslucentScreen.setDescriptionLabelDirection('Right')\n```\nIf you set the description label direction right like the example above, description text will be shown on the right side of the loading icon.\n\nIf you want to show loading icon only, make instance like this.\n```python\nself.__loadingTranslucentScreen = LoadingTranslucentScreen(parent=self, dot_animation=False)\n```\n\n## Example\n### Code Sample\n```python\nimport time\nfrom PyQt5.QtWidgets import QPushButton, QTextEdit, QVBoxLayout, QWidget, QApplication\n\nfrom pyqt_translucent_full_loading_screen_thread import LoadingThread, LoadingTranslucentScreen\n\n# for second result\nclass MyThread(LoadingThread):\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n    def run(self):\n        time.sleep(1)\n\n\nclass Main(QWidget):\n    def __init__(self):\n        super().__init__()\n        self.__initUi()\n\n    def __initUi(self):\n        btn = QPushButton('Start Loading Thread')\n        btn.clicked.connect(self.__startLoadingThread)\n        self.__te = QTextEdit()\n\n        lay = QVBoxLayout()\n        lay.addWidget(btn)\n        lay.addWidget(self.__te)\n\n        self.setLayout(lay)\n\n    def __startLoadingThread(self):\n        self.__loadingTranslucentScreen = LoadingTranslucentScreen(parent=self,\n                                                                   description_text='Waiting')\n        self.__loadingTranslucentScreen.setDescriptionLabelDirection('Right')\n        self.__thread = LoadingThread(loading_screen=self.__loadingTranslucentScreen)\n        # for second result\n        # self.__thread = MyThread(loading_screen=self.__loadingTranslucentScreen)\n        self.__thread.start()\n\n\nif __name__ == '__main__':\n    import sys\n\n    app = QApplication(sys.argv)\n    window = Main()\n    window.show()\n    app.exec()\n```\n\n### Result\n\n#### 1. Result of ```LoadingThread``` which is module itself\n\nhttps://user-images.githubusercontent.com/55078043/152469234-50e72870-e0c4-4b6a-a364-3a28fd23c501.mp4\n\nLoading screen is shown for 5 seconds.\n\n#### 2. Result of ```MyThread``` which inherits the ```LoadingThread```\n\nhttps://user-images.githubusercontent.com/55078043/152469243-3044ff32-afe5-4e35-8c61-7b9003e30bf4.mp4\n\nLoading screen is shown for 1 second. Because ```run()``` method of ```MyThread``` overrides ```LoadingThread```'s.\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjg30737%2Fpyqt-translucent-full-loading-screen-thread","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyjg30737%2Fpyqt-translucent-full-loading-screen-thread","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjg30737%2Fpyqt-translucent-full-loading-screen-thread/lists"}