Pacetype 🐢
Simulates typing text, including emojis and special characters, with adjustable delays for specific characters. Uses pyautogui.typewrite() for speed with standard characters and the clipboard for robust cross-platform compatibility with complex characters (like emojis) that often cause issues with direct key simulation.
🤔 Why Pacetype?
Automating keyboard input with libraries like pyautogui can be fast for standard text but tricky when dealing with emojis or complex Unicode characters. Direct key simulation (pyautogui.typewrite) doesn't always handle these complex characters correctly across different OSs and input methods. Conversely, simulating copy-paste for every character is reliable but slower.
pacetype offers a hybrid approach:
- It detects standard, printable characters and types them rapidly using
pyautogui.typewrite(). - When it encounters a complex character (emoji, symbol, non-printable), it switches to the clipboard method:
- Copies the single complex character to the system clipboard.
- Simulates the standard "paste" keyboard shortcut (Ctrl+V or Cmd+V).
- Waits for a specified
interval(if provided) only after pasting a complex character.
This hybrid method provides the speed of typewrite for normal text and the reliability of the clipboard for special characters.
🚀 Installation
pip install pacetype
✨ Simple Usage
Using pacetype is straightforward. Just import it and call it directly with the text you want to type.
import pacetype
import time
# Give yourself a moment to switch to the target window
print("Pacetyping in 3 seconds...")
time.sleep(3)
# Type text with complex characters. Delay only applies after 👋 and 🐢.
# Standard characters are typed quickly.
pacetype("Hello World! 👋 Fast standard text. Slow emoji... 🐢", interval=0.5)
# Type text rapidly (no interval delay for clipboard pastes)
pacetype("Typing emojis quickly! ✅🚀", interval=0.0)
# Type standard text very fast (uses typewrite, interval is ignored)
pacetype("This uses pyautogui.typewrite and is fast.", interval=0.5) # interval has no effect here
print("Typing finished!")
Key Points:
- Hybrid Typing: Standard characters are typed using the fast
pyautogui.typewrite(interval=0). Complex characters (emojis, etc.) are pasted via the clipboard. - Conditional Delay: The
intervalargument (defaulting to0.0) applies only as atime.sleep()pause after a complex character has been pasted using the clipboard. It does not affect the speed of standard character typing. - Clipboard for Complexity: The clipboard method ensures greater reliability for emojis and a wide range of special characters that
typewritemight fail on.
⚙️ Features
- Hybrid Typing: Fast typing for standard text, reliable clipboard pasting for complex characters.
- Emoji & Unicode Support: Reliably types emojis and complex characters via the clipboard.
- Conditional Delay: Control paste speed for complex characters with the optional
intervalargument. - Simple Callable API: Just
import pacetypeand usepacetype("your text", interval=...). - Cross-Platform: Works on Windows, macOS, and Linux (thanks to
pyperclipandpyautogui).
⚠️ Important Notes
- Window Focus: The target application window (e.g., text editor, browser, chat) must have keyboard focus when
pacetype()is executing. - Clipboard Use: Pacetype uses the system clipboard when pasting complex characters. Any content you manually copy while it's pasting such a character might be overwritten. The clipboard will contain the last complex character pasted after the script finishes. Standard typing does not affect the clipboard.
- Keyboard Shortcuts: Assumes standard
Ctrl+V(Windows/Linux) orCmd+V(macOS) paste shortcuts are active.
🤝 Contributing
Contributions, issues, and feature requests are welcome!
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for pacetype 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pacetype-0.3.0.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pacetype-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.7 kB
Release files / pacetype-0.3.0.tar.gz
| Download URL | pacetype-0.3.0.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
805a012d8ee7b6847c6e14acc7ba8e95d740efd2b9ca6e6c9a2c21ec01e8c032
|
|
BLAKE2b-256 checksum How to use checksums |
42c5c036a25d22660ddba0f54d573730ecb77817f1baa72624be45043a276a9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.6
|
Release files / pacetype-0.3.0-py3-none-any.whl
| Download URL | pacetype-0.3.0-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bcf0491b599f16ac1b7ed60f4c0bbef9a9efb69f30ec1fe80dc64496bc450a63
|
|
BLAKE2b-256 checksum How to use checksums |
e2b9e04a206b1063f75e3e740eec2c8960b0be6125086c9441536bab1cfb826d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.6
|