-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
59 lines (43 loc) · 1.17 KB
/
test.py
File metadata and controls
59 lines (43 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from curses import noecho
import sys
import os
os.system('') #enable VT100 Escape Sequence for WINDOWS 10 Ver. 1607
from prompt_toolkit import prompt
from prompt_toolkit.completion import NestedCompleter
from prompt_toolkit.formatted_text import HTML
from prompt_toolkit.styles import Style
def gg():
print("gg")
variabile = ("a", "w")
dict = {
'/exit': None,
'/logout': None,
'/help': None,
'/clear': None,
'/poke': {}
}
for i in variabile:
dict['/poke'][i] = None
completer = NestedCompleter.from_nested_dict(dict)
style = Style.from_dict({
# User input (default text).
'': '#ff0066',
# Prompt.
'username': '#884444',
'colon': '#0000aa',
'pound': '#00aa00',
})
message = [
('class:username', 'Matt05'),
('class:colon', ':'),
('class:pound', '> '),
]
def bottom_toolbar():
return HTML('Logged as <b><style bg="ansired">Matt05</style></b>!')
CURSOR_UP_ONE = '\x1b[1A'
ERASE_LINE = '\x1b[2K'
print('Text 1\nText 2\nText 3')
inp = ''
while inp != 'END':
inp = prompt(message, completer=completer, bottom_toolbar=bottom_toolbar, style=style)
print(CURSOR_UP_ONE + ERASE_LINE + inp)