1-st is code
Сперва код
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.button import Button
from kivy.uix.widget import Widget
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from kivy.config import Config
Config.set('graphics', 'resizable', 0)
Config.set('graphics', 'width', 400) # Ширина
Config.set('graphics', 'heith', 500)
class My(App):
def build(self):
bl = BoxLayout(orientation = 'vertical', padding = 25)
gl = GridLayout(cols = 4, spacing = 3, size_hint = (1, .6))
self.lbl = Label( text = '01234', font_size = 40, holign = 'right', size_hint = (1, .4))
bl.add_widget( self.lbl )
gl.add_widget( Button(text = '7'))
gl.add_widget( Button(text = '8'))
gl.add_widget( Button(text = '9'))
gl.add_widget( Button(text = 'X'))
gl.add_widget( Button(text = '4'))
gl.add_widget( Button(text = '5'))
gl.add_widget( Button(text = '6'))
gl.add_widget( Button(text = '-'))
gl.add_widget( Button(text = '1'))
gl.add_widget( Button(text = '2'))
gl.add_widget( Button(text = '3'))
gl.add_widget( Button(text = '+'))
gl.add_widget( text = '')
gl.add_widget( Button(text = '0'))
gl.add_widget( Button(text = '.'))
gl.add_widget( Button(text = '='))
bl.add_widget( gl )
return bl
Secondary: cmd says
Во-вторых: cmd выдаёт
File "D:\Kivy lessons\lesson3.py", line 55, in
My().run()
File "C:\Users\Администратор\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\app.py", line 829, in run
root = self.build()
File "D:\Kivy lessons\lesson3.py", line 21, in build
self.lbl = Label( text = '01234', font_size = 40, holign = 'right', size_hint = (1, .4))
File "C:\Users\Администратор\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\uix\label.py", line 318, in __init__
super(Label, self).__init__(**kwargs)
File "C:\Users\Администратор\AppData\Local\Programs\Python\Python36-32\lib\site-packages\kivy\uix\widget.py", line 350, in __init__
super(Widget, self).__init__(**kwargs)
File "kivy\_event.pyx", line 243, in kivy._event.EventDispatcher.__init__
TypeError: object.__init__() takes no parameters