Skip to main content

A silly module to control the keyboard LEDs of the CapsLock, NumLock, and ScrollLock keys to flash Morse Code on Windows, macOS, and Linux.

Project description

CapsLockMorseCode

A silly module to control the keyboard LEDs of the CapsLock, NumLock, and ScrollLock keys to flash Morse Code on Windows, macOS, and Linux.

Installation

To install with pip on macOS or Linux, run:

python3 -m pip install capslockmorsecode

To install with pip on Windows, run:

py -m pip install capslockmorsecode

Quickstart Guide

You can pass a string to morse() to flash morse code with the CapsLock key. The string can either be text or morse code written with . for dots, - for dashes, / for intercharacter spacing, and a space character for word spacing:

>>> import capslockmorsecode as mc
>>> mc.morse('sos')
>>> mc.morse('.../---/...')

You can also flash individual dots and dashes with dot() and dash():

>>> import capslockmorsecode as mc
>>> mc.dot()
>>> mc.dash()

You can directly control the CapsLock and NumLock LEDs by passing True (on) or False (off) to caps_lock(), or just call caps_lock() to get the current state of it:

>>> import capslockmorsecode as mc
>>> mc.caps_lock(True)  # Turn on caps lock.
>>> mc.caps_lock()
True
>>> mc.caps_lock(False) # Turn off caps lock.

Same for NumLock/ScrollLock with the num_lock() and scroll_lock() functions:

>>> import capslockmorsecode as mc
>>> mc.num_lock(True)  # Turn on num lock.
>>> mc.num_lock()
True
>>> mc.num_lock(False) # Turn off num lock.
>>> mc.scroll_lock(True)  # Turn on scroll lock.
>>> mc.scroll_lock()
True
>>> mc.scroll_lock(False) # Turn off scroll lock.

Contribute

If you'd like to contribute to CapsLockMorseCode, check out https://github.com/asweigart/capslockmorsecode

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

CapsLockMorseCode-0.1.0.tar.gz (5.3 kB view details)

Uploaded Source

File details

Details for the file CapsLockMorseCode-0.1.0.tar.gz.

File metadata

  • Download URL: CapsLockMorseCode-0.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for CapsLockMorseCode-0.1.0.tar.gz
Algorithm Hash digest
SHA256 07f5804030083049d95b30ae9ee35adee3fb411555b1eb7fed93d552cc4b6455
MD5 f1dad5af043a832c46f6702f88d6af44
BLAKE2b-256 22fcbf12a380b668db53195f46418336dd4b50cba7488c5177a37a0e60c8c314

See more details on using hashes here.

Provenance

Supported by

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