Basically the title, i have a small python script (python 3.9, Windows 10) that i would like to keep running in the background. It is currently listening for keyboard hotkeys and acting like a macro engine. I want it to stay idle, since i use the keyboard module so i doesnt need to call anything, just wait.
I tried a while loop with either pass or sleep in it, but both have downsides, the one with pass using a lot of cpu ressources, and the one with sleep being very unreliable.
Is there any pretty/good practice way of doing this ?
How to keep a python script idle without using too many ressources
179 Views Asked by LostExcalibur At
1
There are 1 best solutions below
Related Questions in PYTHON-3.X
- SQLAlchemy 2 Can't add additional column when specifying __table__
- Writes to child subprocess.Popen.stdin don't work from within process group?
- Platform Generation for a Sky Hop clone
- What's the best way to breakup a large test in pytest
- chess endgame engine in Python doesn't work perfectly
- Function to create matrix of zeros and ones, with a certain density of ones
- how to create a polars dataframe giving the colum-names from a list
- Django socketio process
- How to decode audio stream using tornado websocket?
- Getting website metadata (Excel VBA/Python)
- How to get text and other elements to display over the Video in Tkinter?
- Tkinter App - My Toplevel window is not appearing. App is stuck in mainloop
- Can I use local resources for mp4 playback?
- How to pass the value of a function of one class to a function of another with the @property decorator
- Python ModuleNotFoundError for command line tools built with setup.py
Related Questions in BACKGROUND-PROCESS
- Run Jobs Sequentially, in the Background, in Bash
- Logging after return statement in method && asynchronous logging
- Handling Data Transmission in Foreground Service with WebSocket and Managing Downtime
- Is anyone used react-native-background-geolocation?
- How to properly request location permissions for background location updates in Flutter?
- Configure a background service in .NET 8 MAUI for Windows
- Run method works with widgets from background task in Flutter Dart
- Persistent Background Task in iOS 2024
- setWallpaper in Android after app terminated
- React-native-background-action Cannot read property 'start' of null
- How to Sync Data to Server from a Flutter Windows App Even When the App is Closed?
- Set wallpaper in Headless JS react native background task
- How to run a service in background on Android 10? Rooted device
- how can i make a php function to continue to run with the while loop in background?
- How to convert java application with process in background to installer?
Related Questions in IDLE-PROCESSING
- Javascript: requestIdleCallback with timeout is always fired immediately
- Powershell Script - Shutdown PC after set idle time
- Script to turn off PC if user is inactive for a certain time period in PowerShell
- Apache unexpectedly lost all idle processes
- How to keep a python script idle without using too many ressources
- Launch application once user inactivity detected C#
- Android service not working when phone is idle / dozing / locked
- Complex numbers calculator
- tkinter optionmenu hangs when clicked if after_idle is called elsewhere in the program
- bash script: getting idle time and compare it
- PaaS providers where servers don't sleep because of idleness as Heroku?
- How to know idle time for process running in system
- How to detect idle time in Javafx
- Detect existing idle application
- Detect if user Idle on computer (vs in a windows universal app)
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I would suggest to use some library that does the trick for you.
For example you can try Asyncio:
Here's an Asyncio example for keypress.