Skip to main content

A small example package for simulating human writing

Project description

LazyWriter - Python Package

LazyWriter is a Python application designed to simulate a typing experience with the ability to introduce small delays, potential errors, and interruptions during text entry. It uses a GUI built with PyQt6 and allows users to select different writing profiles to control the speed and accuracy of the typing. The application is built to be both fun and interactive, offering a simulation of human-like typing with errors and pauses.

Features

  • Interactive GUI: Built with PyQt6, it provides an intuitive user interface for controlling the typing process.
  • Customizable Profiles: Choose from different typing profiles that affect the speed, accuracy, and error rates during the typing simulation.
  • Text Entry Simulation: Simulate typing by controlling various factors like typing speed, chance of failure, and pauses between words and characters.
  • Error Simulation: The program can simulate errors, including extra characters, incorrect characters, and missed characters.
  • Real-time Feedback: The application provides a visual interface to track the progress and stop the typing process anytime.

Installation

To use LazyWriter, you need to have Python 3.6+ installed along with the necessary dependencies. You can install the required packages using pip:

pip install pynput PyQt6

How to Use

  1. Run the Application: Launch the application by running the following Python script:

    python lazy_writer.py
    
  2. Select a Profile: In the GUI, you can select from three typing profiles:

    • Neuneu: A slow, error-prone typing profile.
    • Normal: A standard typing speed and error rate.
    • HyperActif: A fast typing profile with a higher chance of mistakes.
  3. Start Typing:

    • Enter or paste your text into the text input field.
    • Click the "Write Text!" button to start the typing simulation.
    • Click the "Stop Writing" button to interrupt the typing process at any time.
  4. Watch for Errors: As the text is being typed, you may see random errors introduced based on the selected profile. These could be:

    • Extra characters.
    • Incorrect characters.
    • Missing characters.
  5. Pause and Delays: The program introduces small delays between typing characters and words, simulating real human typing behavior.

Code Overview

Main Window

The MainWindow class creates the main GUI window. It includes the following key elements:

  • Text Input: A QTextEdit widget where the user enters the text to be typed.
  • Start/Stop Buttons: Buttons to start and stop the typing simulation.
  • Profile Selector: A dropdown menu for selecting a typing profile.

Profile Class

The Profile class defines the parameters for the typing simulation. These parameters include:

  • min_time_delay and max_time_delay: Control the speed of typing.
  • chance_char, chance_word: Determine the likelihood of taking a break between characters and words.
  • chance_to_fail_writing: The chance of making an error during typing.
  • chance_to_see_error: The chance that an error will be noticed and corrected.

WriteTask Class

The WriteTask class is a QThread that simulates typing text in a separate thread. It uses the pynput module to control the keyboard and simulate typing.

Key methods:

  • write_text: Handles the writing of the entire text.
  • write_char: Types individual characters.
  • write_word: Types words with optional delays and errors.
  • delete_word: Simulates deleting a word with corresponding pauses.

GUI Interaction

The application listens for button clicks and dropdown changes. When the user clicks "Write Text!", it triggers the start of the typing simulation in a separate thread. If the user clicks "Stop Writing", the current task is interrupted.

Example Usage

Here's an example of how to run the application:

import sys
from PyQt6.QtWidgets import QApplication
from lazy_writer_raphael_senellart.window import MainWindow

def main():    
    app = QApplication(sys.argv)
    window = MainWindow()
    window.show()
    sys.exit(app.exec())

if __name__ == "__main__":
    main()

Customizing the Typing Profile

The Profile class allows for creating custom profiles. You can adjust parameters such as the typing speed, error rates, and more to tailor the simulation to your needs.

Example of creating a custom profile:

custom_profile = Profile(
    min_time_delay=100000, 
    max_time_delay=200000, 
    chance_char=150, 
    min_time_char=100000, 
    max_time_char=6000000,
    chance_word=30, 
    min_time_word=100000, 
    max_time_word=4000000, 
    chance_to_fail_writing=70, 
    chance_to_see_error=3
)

Contributing

Feel free to contribute to LazyWriter by forking the repository, making your changes, and submitting a pull request. Suggestions and improvements are welcome!

License

This project is licensed under the MIT License - see the LICENSE file for details.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lazywriter-0.2.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lazywriter-0.2-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file lazywriter-0.2.tar.gz.

File metadata

  • Download URL: lazywriter-0.2.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for lazywriter-0.2.tar.gz
Algorithm Hash digest
SHA256 19da2e195ec03b0667a77b5310bf20c94e8540b6e5397839e59ad3397c43048b
MD5 3eab632be3979dce996d41a5abba2e41
BLAKE2b-256 394d8a8a8a14acb994217b518b3266d4a61557b52bf1ed111292f66b84c26a83

See more details on using hashes here.

File details

Details for the file lazywriter-0.2-py3-none-any.whl.

File metadata

  • Download URL: lazywriter-0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for lazywriter-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a431bf3e88a540335947764991019ad3dd48959b3f8a9b60b7e0e1a7f75d512c
MD5 fda1907c79595ca17e87a6f2006d5945
BLAKE2b-256 fdfa433537ab48c9616100d281994a1ad5160e46820c420b0de973b1e238f399

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page