prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.25k stars 714 forks source link

style_from_dict / Token is not found inside version 8.0.0 #1539

Open liamBilich opened 2 years ago

liamBilich commented 2 years ago

The docs show usage of setting bottom toolbar style using style_From_dict method and Token

But both are not found in the packages:

from prompt_toolkit.styles import style_from_dict
from prompt_toolkit.token import Token
dolby360 commented 2 years ago

Happen to me as well. prompt_toolkit==3.0.30

mmihir82 commented 1 year ago

Has anyone able to resolve the issue using newer release?

jonathanslenders commented 1 year ago

Can any of you show where this is still mentioned? This is an old API, and those imports are nowhere to be found in the current master branch.

See here for the docs: https://python-prompt-toolkit.readthedocs.io/en/master/pages/asking_for_input.html#adding-a-bottom-toolbar One example is:

from prompt_toolkit import prompt
from prompt_toolkit.styles import Style

def bottom_toolbar():
    return [('class:bottom-toolbar', ' This is a toolbar. ')]

style = Style.from_dict({
    'bottom-toolbar': '#ffffff bg:#333333',
})

text = prompt('> ', bottom_toolbar=bottom_toolbar, style=style)
print('You said: %s' % text)