Skip to content

Commit 915b360

Browse files
Minor tweaks to advanced example
1 parent aedccd9 commit 915b360

File tree

1 file changed

+37
-4
lines changed

1 file changed

+37
-4
lines changed

examples/display_text_advance_example.py

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,21 @@
2828
main_group.append(horizontal_line)
2929

3030
bitmap = displayio.Bitmap(display.width, 4, 2)
31-
vertica_line = displayio.TileGrid(bitmap, pixel_shader=palette, x=0, y=110)
32-
main_group.append(vertica_line)
31+
vertical_line = displayio.TileGrid(bitmap, pixel_shader=palette, x=0, y=110)
32+
main_group.append(vertical_line)
33+
3334
# Tests
3435
text_area = label.Label(terminalio.FONT, text="Circuit Python")
3536
main_group.append(text_area)
3637
display.show(main_group)
3738
time.sleep(TIME_PAUSE)
39+
3840
# Testing position setter
3941
text_area.x = 10
4042
text_area.y = 10
4143
display.show(main_group)
4244
time.sleep(TIME_PAUSE)
45+
4346
# Testing creating label with initial position
4447
text_area.text = "Testing initiating without text"
4548
try:
@@ -64,17 +67,20 @@
6467
main_group.append(text_middle)
6568
display.show(main_group)
6669
time.sleep(TIME_PAUSE)
70+
6771
# Testing Text Setter
6872
text_area.text = "Testing Changing Text"
6973
text_middle.text = "Python"
7074
display.show(main_group)
7175
time.sleep(TIME_PAUSE)
76+
7277
# Testing a and y getter and setter
7378
text_area.text = "Testing Changing Position"
7479
text_middle.x = text_middle.x - 50
7580
text_middle.y = text_middle.y - 50
7681
display.show(main_group)
7782
time.sleep(TIME_PAUSE)
83+
7884
# Testing font Getter and setter
7985
text_area.text = "Testing Changing FONT"
8086
if isinstance(text_middle.font, fontio.BuiltinFont):
@@ -84,6 +90,7 @@
8490

8591
# Once this working we create another label with all the initial specs
8692
main_group.pop()
93+
8794
# Testing Color
8895
text_area.text = "Testing Color"
8996
text_initial_specs = label.Label(
@@ -95,10 +102,12 @@
95102
main_group.append(text_initial_specs)
96103
display.show(main_group)
97104
time.sleep(TIME_PAUSE)
105+
98106
text_initial_specs.color = 0x004400
99107
display.show(main_group)
100108
time.sleep(TIME_PAUSE)
101109
main_group.pop()
110+
102111
# Testing Background Color
103112
text_area.text = "Testing Background Color"
104113
text_initial_specs = label.Label(
@@ -111,10 +120,12 @@
111120
main_group.append(text_initial_specs)
112121
display.show(main_group)
113122
time.sleep(TIME_PAUSE)
123+
114124
text_initial_specs.background_color = 0x990099
115125
display.show(main_group)
116126
time.sleep(TIME_PAUSE)
117127
main_group.pop()
128+
118129
# Testing Background Color
119130
text_area.text = "Testing Background Tight"
120131
text_initial_specs = label.Label(
@@ -177,7 +188,8 @@
177188
)
178189
main_group.append(text_initial_specs)
179190
display.show(main_group)
180-
time.sleep(1)
191+
time.sleep(TIME_PAUSE)
192+
181193
try:
182194
text_initial_specs.anchored_position = (100, 100)
183195
text_initial_specs.anchor_point = (0.5, 0.5)
@@ -217,6 +229,7 @@
217229
main_group.append(text_initial_specs)
218230
display.show(main_group)
219231
time.sleep(TIME_PAUSE)
232+
220233
text_initial_specs.scale = 2
221234
display.show(main_group)
222235
time.sleep(TIME_PAUSE)
@@ -270,6 +283,7 @@
270283
display.show(main_group)
271284
time.sleep(TIME_PAUSE)
272285
main_group.pop()
286+
273287
text_area.text = "Testing Direction-DWR"
274288
text_initial_specs = label.Label(
275289
MEDIUM_FONT,
@@ -290,6 +304,7 @@
290304
display.show(main_group)
291305
time.sleep(TIME_PAUSE)
292306
main_group.pop()
307+
293308
text_area.text = "Testing Direction-TTB"
294309
text_initial_specs = label.Label(
295310
MEDIUM_FONT,
@@ -310,6 +325,7 @@
310325
display.show(main_group)
311326
time.sleep(TIME_PAUSE)
312327
main_group.pop()
328+
313329
text_area.text = "Testing Direction-RTL"
314330
text_initial_specs = label.Label(
315331
MEDIUM_FONT,
@@ -367,26 +383,31 @@
367383
main_group.append(text_middle)
368384
display.show(main_group)
369385
time.sleep(TIME_PAUSE)
386+
370387
# Testing Text Setter
371388
text_area.text = "Testing Changing Text"
372389
text_middle.text = "Python"
373390
display.show(main_group)
374391
time.sleep(TIME_PAUSE)
392+
375393
# Testing a and y getter and setter
376394
text_area.text = "Testing Changing Position"
377395
text_middle.x = text_middle.x - 50
378396
text_middle.y = text_middle.y - 50
379397
display.show(main_group)
380398
time.sleep(TIME_PAUSE)
399+
381400
# Testing font Getter and setter
382401
text_area.text = "Testing Changing FONT"
383402
if isinstance(text_middle.font, fontio.BuiltinFont):
403+
print("Font was BuiltinFont")
384404
text_middle.font = MEDIUM_FONT
385405
display.show(main_group)
386406
time.sleep(TIME_PAUSE)
387407

388408
# Once this working we create another label with all the initial specs
389409
main_group.pop()
410+
390411
# Testing Color
391412
text_area.text = "Testing Color"
392413
text_initial_specs = bitmap_label.Label(
@@ -398,10 +419,12 @@
398419
main_group.append(text_initial_specs)
399420
display.show(main_group)
400421
time.sleep(TIME_PAUSE)
422+
401423
text_initial_specs.color = 0x004400
402424
display.show(main_group)
403425
time.sleep(TIME_PAUSE)
404426
main_group.pop()
427+
405428
# Testing Background Color
406429
text_area.text = "Testing Background Color"
407430
text_initial_specs = bitmap_label.Label(
@@ -414,10 +437,12 @@
414437
main_group.append(text_initial_specs)
415438
display.show(main_group)
416439
time.sleep(TIME_PAUSE)
440+
417441
text_initial_specs.background_color = 0x990099
418442
display.show(main_group)
419443
time.sleep(TIME_PAUSE)
420444
main_group.pop()
445+
421446
# Testing Background Color
422447
text_area.text = "Testing Background Tight"
423448
text_initial_specs = bitmap_label.Label(
@@ -480,7 +505,8 @@
480505
)
481506
main_group.append(text_initial_specs)
482507
display.show(main_group)
483-
time.sleep(1)
508+
time.sleep(TIME_PAUSE)
509+
484510
try:
485511
text_initial_specs.anchored_position = (100, 100)
486512
text_initial_specs.anchor_point = (0.5, 0.5)
@@ -520,6 +546,7 @@
520546
main_group.append(text_initial_specs)
521547
display.show(main_group)
522548
time.sleep(TIME_PAUSE)
549+
523550
text_initial_specs.scale = 2
524551
display.show(main_group)
525552
time.sleep(TIME_PAUSE)
@@ -573,6 +600,7 @@
573600
display.show(main_group)
574601
time.sleep(TIME_PAUSE)
575602
main_group.pop()
603+
576604
text_area.text = "Testing Direction-DWR"
577605
text_initial_specs = bitmap_label.Label(
578606
MEDIUM_FONT,
@@ -593,6 +621,7 @@
593621
display.show(main_group)
594622
time.sleep(TIME_PAUSE)
595623
main_group.pop()
624+
596625
text_area.text = "Testing Direction-UPD"
597626
text_initial_specs = bitmap_label.Label(
598627
MEDIUM_FONT,
@@ -613,6 +642,7 @@
613642
display.show(main_group)
614643
time.sleep(TIME_PAUSE)
615644
main_group.pop()
645+
616646
text_area.text = "Testing Direction-RTL"
617647
text_initial_specs = bitmap_label.Label(
618648
MEDIUM_FONT,
@@ -633,3 +663,6 @@
633663
display.show(main_group)
634664
time.sleep(TIME_PAUSE)
635665
main_group.pop()
666+
667+
text_area.text = "Finished"
668+
print("Tests finished")

0 commit comments

Comments
 (0)