K
K
kopelev20002018-08-22 17:13:42
Python
kopelev2000, 2018-08-22 17:13:42

Python + Kivy, the program window opens and immediately closes, gives an error?

The code itself:
from kivy.app import App
from kivy.config import Config
from kivy.uix.textinput import TextInput
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.anchorlayout import AnchorLayout
class MyApp( App):
def build(self):
al = AnchorLayout()
bl = BoxLayout(arientation='vertical', size_hint=[.4, .4])
bl.add_widget(TextInput())
bl.add_widget(Label(text= "Press ctrl + c to enter password"))
al.add_widget(bl)
return al
if __name__ == "__main__":
Config.set('graphics', 'fullscreen', 'auto')
Config.set('graphics', 'window_state', 'maximized')
Config.write()
MyApp().run()
Here is the error:
Traceback (most recent call last):
File "C:/Users/users/Desktop/ Python2222/locker.py", line 24, in
YourApp().run()
File "C:\Users\users\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\app.py ", line 800, in run
root = self.build()
File "C:/Users/users/Desktop/Python2222/locker.py", line 13, in build
bl = BoxLayout(arientation='vertical', size_hint=[ .4, .4])
File "C:\Users\users\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\uix\boxlayout.py", line 131,in __init__
super(BoxLayout, self).__init__(**kwargs)
File "C:\Users\users\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\uix\layout.py", line 76, in __init__
super(Layout, self).__init__( **kwargs)
File "C:\Users\users\AppData\Local\Programs\Python\Python37-32\lib\site-packages\kivy\uix\widget.py", line 340, in __init__
super(Widget, self ).__init__(**kwargs)
File "kivy\_event.pyx", line 243, in kivy._event.EventDispatcher.__init__ TypeError
: object.__init__() takes no arguments
Process finished with exit code
strictly do not judge if it is stupid

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Tikhonov, 2018-08-22
@kopelev2000

Error on line 13.

bl = BoxLayout(arientation='vertical', size_hint=[.4, .4])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question