Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. from kivy.app import App
  2. from kivy.uix.button import Button
  3. #from kivy.uix.codeinput import CodeInput
  4. #from pygments.lexers import HtmlLexer
  5.  
  6. from kivy.config import Config
  7. Config.set('graphics', 'resizable', '0');
  8.  
  9. from kivy.uix.floatlayout import FloatLayout
  10. from kivy.uix.scatter import Scatter
  11.  
  12. # noinspection PyUnreachableCode
  13. class MyApp(App):
  14. def build(self):
  15. s = Scatter()
  16. fl = FloatLayout(size = (300, 300))
  17. s.add_widget(fl)
  18. fl.add_widget(Button(
  19. text="Это Кнопка!",
  20. font_size = 16,
  21. on_press = self.btn_press,
  22. background_color = [.32, .85, .94, 1],
  23. background_normal = '',
  24. size_hint = (.5, .25),
  25. pos = (0, 10)));
  26. return s
  27.  
  28. def btn_press(self, instance):
  29. print("Кнопка нажата!")
  30. instance.text = "Я нажата"
  31.  
  32.  
  33. if __name__ == "__main__":
  34. MyApp().run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement