46 lines
1.3 KiB
Markdown
46 lines
1.3 KiB
Markdown
# Dialog
|
|
```py
|
|
import PyserSSH.extensions.dialog as dialog
|
|
```
|
|
Dialog extension is a nifty little tool.
|
|
This extension actually recreates standard Windows dialog boxes in a text environment using ANSI escape control codes.
|
|
It is installed in library by default.
|
|
|
|
## Text Dialog
|
|
This dialog show only text
|
|
```py
|
|
DL = dialog.TextDialog(client, "Hello World")
|
|
DL.render()
|
|
```
|
|

|
|
|
|
## Menu Dialog
|
|
This dialog use for choose list
|
|
```py
|
|
Mylist = ["Item 1", "Item 2", "Item 3", "Item 4", "Item 5"]
|
|
|
|
DL = dialog.MenuDialog(client, Mylist)
|
|
DL.render()
|
|
print(DL.output()) # output when user is selected
|
|
```
|
|

|
|
|
|
## Input Dialog
|
|
This dialog use for input string or password
|
|
!!! Bug "Bug"
|
|
Maybe you can't backspace to clear all inputted when you type too fast
|
|
```py
|
|
DL = dialog.TextInputDialog(client)
|
|
DL.render()
|
|
print(DL.output()) # output when user is typed and entered
|
|
```
|
|

|
|
|
|
password input
|
|
```py
|
|
DL = dialog.TextInputDialog(client, password=True)
|
|
DL.render()
|
|
print(DL.output()) # output when user is typed and entered password
|
|
```
|
|

|