-
Notifications
You must be signed in to change notification settings - Fork 747
Closed
Description
Hi,
I am trying to use examples in the documentation, but many of them seem to be out of date. For example:
from prompt_toolkit.shortcuts import prompt
from prompt_toolkit.styles import Style
style = Style.from_dict({
# User input.
'': '#ff0066',
# Prompt.
'username': '#884444',
'at': '#00aa00',
'colon': '#00aa00',
'pound': '#00aa00',
'host': '#000088 bg:#aaaaff',
'path': '#884444 underline',
})
def get_prompt():
return [
('class:username', 'john'),
('class:at', '@'),
('class:host', 'localhost'),
('class:colon', ':'),
('class:path', '/user/john'),
('class:pound', '# '),
]
text = prompt(get_prompt, style=style)
causes exception: "AttributeError: type object 'Style' has no attribute 'from_dict'". I had issues with most of the examples I tried so far, but had satisfaction following this article: 4 Python libraries for building great command-line user interfaces.
Am I missing something? Is it maybe because examples are not updated to version 2?
Best Regards
Metadata
Metadata
Assignees
Labels
No labels