S
S
SepultureSE2021-01-06 15:31:07
Python
SepultureSE, 2021-01-06 15:31:07

How to fix npyscreen error?

This is probably a stupid question, but I need help. Decided to try npyscreen the other day . I'm on Windows myself. npyscreen is dependent on curses and curses is not compatible with Windows, as I understand it. So I installed windows-curses . I wrote the simplest code according to the article on habr:

import npyscreen


class App(npyscreen.StandardApp):
    """ Класс приложения npyscreen """
    def onStart(self):
        self.addForm('MAIN', ChatBoxForm, name='Chat Box')

class ChatBoxForm(npyscreen.ActionForm):
    """ Форма виджета на котором будет написан заголовок """
    def create(self):
        self.title = self.add(npyscreen.TitleText, name='TitleText', value='Hello World')

    def on_ok(self):
        self.parentApp.setNextForm(None)

    def on_cancel(self):
        self.title.value = "Hello World!"


if __name__ == '__main__':
    MyApp = App()
    MyApp.run()


I run the code, for a moment the executed script appears, what I need, but then it disappears and I get an error: RuntimeError: generator raised StopIteration

Uploaded a video to the Cloud, what happens when I run the script: *watch video*
My version of Python : Python 3.9.1

P.S. I've tried using different versions of Python. 7, 8, 9.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
o5a, 2021-01-06
@SepultureSE

This error is googling. The problem is in the changes in the work of Python 3.7+
npyscreen was not finalized for them.
For example, they also offer an alternative version of the module as an option
https://github.com/jwoglom/signal-curses/issues/7

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question