JamZYM 6 mēneši atpakaļ
vecāks
revīzija
f01a1fcf27
2 mainītis faili ar 13 papildinājumiem un 14 dzēšanām
  1. 9 3
      main.py
  2. 4 11
      sti2021a.kv

+ 9 - 3
main.py

@@ -1,6 +1,7 @@
 from kivy.app import App
 from kivy.uix.widget import Widget
 from kivy.uix.button import Button
+from kivy.uix.gridlayout import GridLayout
 from kivy.properties import (
     StringProperty,NumericProperty,
 )
@@ -48,9 +49,14 @@ class InfoWidget(Widget):
     #         else:
     #             print("Failed to connect to device.")
     def debug(self):
-        for i in range(6):
-            button = Button(text=str(i) + "!!!!!!")
-            self.add_widget(button)
+        # self.size = (800,480)
+        grid = GridLayout(cols=2,rows=4,width=self.width,height=self.height)
+        self.add_widget(grid)
+        for i in range(8):
+            button = Button(text=str(i))
+            button.width = grid.width / 2
+            button.height = grid.height / 4
+            grid.add_widget(button)
 
 class STI2021A(App):
     def build(self):

+ 4 - 11
sti2021a.kv

@@ -1,13 +1,6 @@
+#:kivy 2.3.0
+
 <InfoWidget>:
     orientation: 'vertical'
-    Button:
-        size_hint_y: None
-        width: root.width / 2
-        height: 100
-        font_size: 50
-    Label:
-        font_size: 100 
-        center_x: root.width / 2
-        top: root.top - 50
-        text: str(root.info)
-        
+    size_hint: 1, 1
+