Skip to main content

inputer: Print before input

If you want to print something before Python default function input() prompt, you can use this package inputer. To achieve this, inputer give you a object to control input like this:

import inputer
import threading
import time

input_handle = inputer.Inputer()

def always_print(input_handle):
    while True:
        input_handle.print_before("I am here!")
        time.sleep(1)

th = threading.Thread(target=always_print, args=(input_handle,), daemon=True)
th.start()

while True:
	text = input_handle.input("> ")
	if text == "exit":
		break

In addition, you can use following methods of Inputer to control input:

  • Inputer.input(prompt=''): Just like Python default function input;
  • Inputer.print_before(*args, **kwargs): Just like Python default function print but print before input prompt;
  • Inputer.eprint_before(*args, **kwargs): Print before input prompt to stdandar error;
  • Inputer.left(n=1): Move current cursor back n position, just like press left key on keybord;
  • Inputer.right(n=1): Move current cursor forward n position, just like press right key on keybord;
  • Inputer.up(n=1): Change current input buffer to last input text, just like press up key on keybord;
  • Inputer.down(n=1): Change current input buffer to next input text, just like press down key on keybord;
  • Inputer.backspace(n=1): Left delete n characters, just like press backspace key on keybord;
  • Inputer.delete(n=1): Right delete n characters, just like press del key on keybord;
  • Inputer.current_str: Get current input buffer text;
  • Inputer.current_cursor: Get current cursor position;
  • Inputer.insert(text): Insert text at current cursor position;
  • Inputer.hide(): Hide prompt text and user input text;
  • Inputer.unhide(): Show prompt text and user input text again;
  • Inputer.block(): Forbidden user input;
  • Inputer.unblock(): Allow user input again;
  • Inputer.use_history(history_filename): All history input is saved in a history file even if you don't call this method. This method allow you to specify a history file to save history input in;

Release files for inputer 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inputer 0.0.2
File Size Uploaded
inputer-0.0.2.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for inputer 0.0.2
File Interpreter ABI Platform
inputer-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.1 kB

Release files / inputer-0.0.2.tar.gz

Download URL inputer-0.0.2.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b487fd6d611469ca1148b59f99a4110ed0e57e07b2b58d335967d13461a0cc05
BLAKE2b-256 checksum
How to use checksums
d6e30e0f91809f38721003cc9c944a223219c0684d472953226fc73a6d0dea0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.2

Release files / inputer-0.0.2-py3-none-any.whl

Download URL inputer-0.0.2-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f527e415688e51c437621a99919983de01af809d89341f23456eb1d5ce08c929
BLAKE2b-256 checksum
How to use checksums
70923d58ac149ec52fb5df6bfc7d8110f7bd79a5cfcc01270fa77beffd7078fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page