Asciimatics doesn't print anything.
xzripper opened this issue · comments
Describe the bug
If I run something, terminal screen just blink one time and script stop working.
To Reproduce
from asciimatics.widgets import Frame, Layout, Button
from asciimatics.screen import Screen
def main(screen):
frame = Frame(screen, 80, 20, has_border=False)
layout = Layout([1, 1, 1, 1])
frame.add_layout(layout)
layout.add_widget(Button("Button 1", lambda: print("Button 1 pressed")), 0)
Screen.wrapper(main)
Expected behavior
It must create button.
Screenshots
I wrote there "python main.py"
System details (please complete the following information):
- OS and version: Windows 10
- Python version: 3.9.13
- Python distribution: Python 3.9.13 (python -V)
- Asciimatics version: 1.14.0
Additional context
Please help!
You haven't created a Scene and then told the screen to play it. Take a look at
asciimatics/samples/contact_list.py
Lines 175 to 180 in 31b3fe5
how do i add to scenes my main function? i dont have any ListView, or ContactView..
from asciimatics.widgets import Frame, Layout, Button
from asciimatics.screen import Screen
from asciimatics.scene import Scene
def main(screen):
frame = Frame(screen, 80, 20, has_border=False)
layout = Layout([1, 1, 1, 1])
frame.add_layout(layout)
layout.add_widget(Button("Button 1", lambda: print("Button 1 pressed")), 0)
screen.play([Scene([frame])])
Screen.wrapper(main)
Solved. Thank!