Questions tagged [prompt-toolkit]

prompt_toolkit is a library for building powerful interactive command lines and terminal applications in Python.

prompt_toolkit is a library for building powerful interactive command lines and terminal applications in Python.

You will find the source code and relevant links to documentation, tutorial, examples here: https://github.com/jonathanslenders/python-prompt-toolkit

58 questions
2
votes
1 answer

Leave incomplete line on screen when hitting Ctrl-C in ipython 5.0+

In older (I believe pre-5.0) versions of IPython, if I was working on a line/block, and suddenly discovered I needed to investigate something else to finish it, my approach was to hit Ctrl-C, which left the incomplete line/block on screen, but…
ShadowRanger
  • 143,180
  • 12
  • 188
  • 271
2
votes
1 answer

How should I do to use the python lib, prompt_toolkit to replace a GNU readline program?

As we all known that Ipython is an amazing tool, and when I read the source code of it, I found that it use prompt_toolkit in its completer. I have a program using the lib readline, and the completer code like below, I wanna change it into…
caimaoy
  • 1,148
  • 1
  • 11
  • 25
2
votes
0 answers

iPython 5 keybinding for Option+

iPython 5 switched to python-prompt-toolkit, and no longer uses readline config (~/.inputrc) On my mac, I have Option+left and Option-right configured as backward-word and forward-word respectively. This works great in my bash shells, and used to…
craigds
  • 2,072
  • 14
  • 25
2
votes
2 answers

Go up one command instead of one line in IPython 5

IPython 5 is a big release. One of its features is real multi-line editing with prompt_toolkit. The up arrow key now moves to the previous input line instead of the previous input command (block of lines). This is awesome, but when my previous…
Socci
  • 337
  • 2
  • 12
2
votes
0 answers

how to add autoreload to ptipython?

In ipython, we could use the following code to enable auto reload feature. %load_ext autoreload %autoreload 2 Now I am using ptipython, I could just type them every time using ptipython, but is there anything that could be automatically executed?…
Daniel Wu
  • 5,853
  • 12
  • 42
  • 93
1
vote
0 answers

not changing the text color inputted from user

i want to change the prompt color to red and the inputted color to blue but it is not working. I am using prompt-toolkit for this purpose prompt_style = styles.Style.from_dict({ 'input_prompt': 'fg:yellow', 'input' : 'fg:blue', …
1
vote
0 answers

Using prompt-toolkit input processing and key binding outside of prompt session

I'm currently using the python prompt-toolkit module to emulate a shell and would like to capture CTRL-Z to force the running command to be back grounded in a way that makes sense for my application. The problem I'm having is the KeyBinding events…
Jaime
  • 1,182
  • 2
  • 12
  • 29
1
vote
0 answers

prompt toolkit accept when enter pressed

I am using prompt toolkit for my CLI. the issue I am facing is when having multiple options and if the user presses "enter" it executes the command. I want different behavior for "enter". when the user presses "enter" it should select the option and…
Hamada Ibrahim
  • 103
  • 1
  • 1
  • 6
1
vote
1 answer

python propmpt-toolkit simple input coloring

I am trying to write a console application for some database entry that would run in terminal. After considering several CLI libraries, I have selected prompt-toolkit as closest to my needs (cli frameworks are overly concentrated towards command…
ljgww
  • 3,418
  • 6
  • 19
  • 21
1
vote
0 answers

Python 3: AttributeError: 'NoneType' object has no attribute 'prompt' when launching from git bash

I have a python 3 application that uses the prompt_toolkit library. If I launch the application through cmd or PowerShell, the application launches without an issue. However, when I launch the application through Windows git bash, I get the…
Youssif Saeed
  • 11,789
  • 4
  • 44
  • 72
1
vote
1 answer

How do you add pageup/pagedown keybindings to TextArea in python-prompt-toolkit?

Let's use calculator.py for example. To add a scrollbar that works with the mouse wheel, you would change: output_field = TextArea(style="class:output-field", text=help_text) to: output_field = TextArea(style="class:output-field", text=help_text,…
Tyler
  • 161
  • 1
  • 11
1
vote
1 answer

Spyder Crash: ModuleNotFoundError: No module named 'prompt_toolkit.enums'

My Spyder (version 4.0) crashed and spyder --reset has no use. I tried conda update spyder and then when I open Spyder in the Anaconda Prompt, it would show these: Traceback (most recent call last): File "E:\Anaconda\Scripts\spyder-script.py",…
fortune
  • 11
  • 3
1
vote
1 answer

How to implement auto closing of double quotes, parentheses, brackets with prompt_toolkit used in iPython 7.x?

IPython since version 5 onward uses prompt_toolkit instead of readline, and I am trying to use its implementation of this package to enable auto closing of double quotes, parentheses and brackets. I have got as far as this code: ip =…
Theo d'Or
  • 783
  • 1
  • 4
  • 17
1
vote
0 answers

prompt toolkit run functions simultaneously

I am trying to run the testprt() function simultaneously with the prompt_toolkit but if I am trying it normally its waiting and after the testprt() functions is run the menu starts but I want it too start simultaneously. I tried it with normal…
Rylisma
  • 11
  • 2
1
vote
1 answer

prompt_toolkit Keys add_binding not working

I am learning prompt-toolkit and try to solve a custom prompt using prompt-toolkit (I already know there is a std. prompt that works differently). I am following the description given by Jonathan for a similar question. So far I took out and…
moin moin
  • 2,263
  • 5
  • 32
  • 51