Kaynağa Gözat

Update 'CARDPUTER CircuitPython/full_display_test.py'

cube 1 yıl önce
ebeveyn
işleme
1990806aab

+ 7
- 0
CARDPUTER CircuitPython/full_display_test.py Dosyayı Görüntüle

24
     elif key == "CTRLD":
24
     elif key == "CTRLD":
25
         text = "Press CTRL+D to clear text\n\n"
25
         text = "Press CTRL+D to clear text\n\n"
26
     else:
26
     else:
27
+        ## WRAPPING
28
+        ## calculate wrapping when entering a character 
29
+        lines = text.split("\n")
30
+        current_line = lines[len(lines)-1]
31
+        if len(current_line) > 35:
32
+            text=text+"\n" # <- start a new line here
33
+        ##############################################
27
         text = text+key
34
         text = text+key
28
     text_area.text = text
35
     text_area.text = text