from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.config import Config
Config.set('graphics', 'width', '800')
Config.set('graphics', 'height', '400')
Config.set('graphics', 'resizable', '0')
class ThoughtApp(App):
def build (self):
base=(BoxLayout(orientation='vertical'))
fl=FloatLayout()
adduser=(Label(text='Добавить участника:',
pos=(-120,360),
font_size=22,
bold=True,
font_name='C:\Windows\Fonts\calibril.ttf',
size_hint=(.6,.1)))
fl.add_widget(adduser)
self.textinput=(TextInput(multiline=False,
pos=(225,355),
size_hint=(.5,.15),
font_size=16))
fl.add_widget(self.textinput)
plusbtn=(Button(size_hint=(27/800,30/800),
text='+',
pos=(635,366.5),
on_press=self.pluspress,
background_color=[.55,.55,.55,1],
background_normal=''))
fl.add_widget(plusbtn)
base.add_widget(fl)
self.names_gl=GridLayout(rows=1,)
base.add_widget(self.names_gl)
return base
def pluspress(self, event):
self.names_gl.add_widget(Button(text=self.textinput.text,
background_color=[.1,.9,.9,1],
background_normal=''))
self.textinput.text=''
if __name__ == '__main__':
ThoughtApp().run()