S
S
Soldat22832020-05-27 13:38:26
Python
Soldat2283, 2020-05-27 13:38:26

The kivy interface window starts and immediately closes, what should I do?

I wrote a code that should open a text input window, but it opens and immediately closes. Here is the error text:
File "Editor.py", line 12, in
MyApp().run()
File "C:\Users\Igor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\kivy \app.py", line 949, in run
self._run_prepare()
File "C:\Users\Igor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\kivy\app.py", line 919, in _run_prepare
root = self.build()
File "Editor.py", line 9, in build
return CodeInput(Lexer = PythonLexer())
File "C:\Users\Igor\AppData\Local\Programs\Python\ Python38-32\lib\site-packages\kivy\uix\codeinput.py", line 101, in __init__
super(CodeInput, self).__init__(**kwargs)
File "C:\Users\Igor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\kivy\uix\textinput.py", line 527, in __init__
super(TextInput, self).__init__(**kwargs)
File "C:\Users\Igor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\kivy\uix\behaviors\ focus.py", line 367, in __init__
super(FocusBehavior, self).__init__(**kwargs)
File "C:\Users\Igor\AppData\Local\Programs\Python\Python38-32\lib\site-packages\ kivy\uix\widget.py", line 350, in __init__
super(Widget, self).__init__(**kwargs)
File "kivy\_event.pyx", line 245, in kivy._event.EventDispatcher.__init__
TypeError: object.__init__() takes exactly one argument (the instance to initialize)

Here is the code:

from kivy.app import App
from kivy.uix.codeinput import CodeInput
from pygments.lexers import PythonLexer

class MyApp(App):
    def build(self):

        return CodeInput(Lexer = PythonLexer())
        
if __name__=="__main__":
  MyApp().run()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Mikhailov, 2020-05-27
@Soldat2283

the word do with a small letter. " Lexer = PythonLexer ()" =>" lexer = PythonLexer ()"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question