{ "info": { "author": "Al Sweigart", "author_email": "al@inventwithpython.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8" ], "description": "# fpstimer\n\nA clock timer that provides sleep()-like features for maintaining a certain \"frames per second\" (FPS) framerate in Python 2 and 3.\n\nSometimes you'll want to slow down your computer so it doesn't run too fast for the user. For example, if you want to run a video game at 60 frames per second (FPS), but the game can render the graphics for the screen in less than 1/60 second, you'll need the program to pause for however much time is remaining in that 1/60 second. This varible amount of time can be calculated by FPS Timer.\n\nInstall\n=======\n\n pip install fpstimer\n\nUsage\n=====\n\nThe frame rate is set by passing the integer FPS to the FPSTimer() constructor. The FPSTimer object has an sleep() method that pauses for a variable amount of time needed to maintain that framerate.\n\nFor example, calling FPSTimer(10) creates a timer for 10 fps. Each \"frame\" should last for 1/10 of a second. Running your program without an FPS timer could cause your program to run too fast for the user, especially as CPUs get faster. After running the code for a single frame, calling sleep() will pause the program for however much is needed for the remaining 1/10 second for that frame. This pause is calculated from the last time that sleep() was called for the previous frame.\n\n >>> import fpstimer\n >>> timer = fpstimer.FPSTimer(60) # Make a timer that is set for 60 fps.\n >>> for i in range(100): # Each iteration of this loop will last (at least) 1/60 of a second.\n ... # Do calculations/work for a single \"frame\" here.\n ... timer.sleep() # Pause just enough to have a 1/60 second wait since last fpstSleep() call.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/asweigart/fpstimer", "keywords": "", "license": "GPLv3+", "maintainer": "", "maintainer_email": "", "name": "fpstimer", "package_url": "https://pypi.org/project/fpstimer/", "platform": "", "project_url": "https://pypi.org/project/fpstimer/", "project_urls": { "Homepage": "https://github.com/asweigart/fpstimer" }, "release_url": "https://pypi.org/project/fpstimer/0.0.1/", "requires_dist": null, "requires_python": "", "summary": "A clock timer that provides sleep()-like features for maintaining a certain \"frames per second\" (FPS) framerate in Python 2 and 3.", "version": "0.0.1" }, "last_serial": 5684772, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "2369a5e1145f2793a30897d737ae92a7", "sha256": "fba3bcebfda796d2eb4251ea88e2b45b1f3909e05afa79812778d0d98c3acfca" }, "downloads": -1, "filename": "fpstimer-0.0.1.tar.gz", "has_sig": false, "md5_digest": "2369a5e1145f2793a30897d737ae92a7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2883, "upload_time": "2019-08-15T23:29:40", "url": "https://files.pythonhosted.org/packages/bf/21/3661d769a596ca345a38f03e55e1b655bd647329a95efc7588bb1a1cddf1/fpstimer-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2369a5e1145f2793a30897d737ae92a7", "sha256": "fba3bcebfda796d2eb4251ea88e2b45b1f3909e05afa79812778d0d98c3acfca" }, "downloads": -1, "filename": "fpstimer-0.0.1.tar.gz", "has_sig": false, "md5_digest": "2369a5e1145f2793a30897d737ae92a7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2883, "upload_time": "2019-08-15T23:29:40", "url": "https://files.pythonhosted.org/packages/bf/21/3661d769a596ca345a38f03e55e1b655bd647329a95efc7588bb1a1cddf1/fpstimer-0.0.1.tar.gz" } ] }