prompt-toolkit / prompt-toolkit/python-prompt-toolkit

Newb Issue: Realtime output

Open
#937 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Description

I'm trying to create a fullscreen CLI for some scripts. I have a fullscreen application that is an input text field and two output text fields.

The first output text field is a "control" output window, for stuff like information regarding which scripts are running, their progress, etc..

The second output text field is a true "output" text field which returns the results from the script.

My issue is that I want to be able to make realtime changes to the "control" output window, to give the user feedback on what step the is being done to launch the script.

Basically it looks like this at the moment...

def do_command(args):
  print_to_control("Preping for command")
  #prep for command
  print_to_control("Executing command")
  output = subprocess.output_check(cmd)
  print_to_output(ouput)
  return

def print_to control(string):
 new_text = control_window.text + string
 control_window.document = Document(text=new_text)
 return

Whenever it runs, it completes the subprocess before updating the command window. What I want is for those prints to occur immediately whenever it occurs in the code.

I've just started using python prompt toolkit so maybe there is an easy way to solve it, but any assistance on this would be great

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Start by reviewing the prompt-toolkit application and event-loop entry points, then trace do_command, print_to_control, and the blocking subprocess.output_check call. The issue does not define a specific implementation or testable completion condition.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.