2024-06-19 22:33:28 +07:00

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()
```
![Text Dialog](../Images/dialogext/textdialog.png)
## 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
```
![Menu Dialog](../Images/dialogext/menudialog.png)
## 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
```
![Text Input Dialog](../Images/dialogext/textinputdialog.png)
password input
```py
DL = dialog.TextInputDialog(client, password=True)
DL.render()
print(DL.output()) # output when user is typed and entered password
```
![Text Input Dialog with password input](../Images/dialogext/textinputdialogwithpasswordinput.png)