Skip to content

Commit dc45987

Browse files
authored
Merge pull request #198 from RetiredWizard/main
replace depreciated .show()
2 parents 47539aa + bd5a728 commit dc45987

15 files changed

+60
-60
lines changed

examples/display_text_advance_example.py

+44-44
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@
3434
# Tests
3535
text_area = label.Label(terminalio.FONT, text="Circuit Python")
3636
main_group.append(text_area)
37-
display.show(main_group)
37+
display.root_group = main_group
3838
time.sleep(TIME_PAUSE)
3939

4040
# Testing position setter
4141
text_area.x = 10
4242
text_area.y = 10
43-
display.show(main_group)
43+
display.root_group = main_group
4444
time.sleep(TIME_PAUSE)
4545

4646
# Testing creating label with initial position
@@ -57,35 +57,35 @@
5757
background_color=0x004499,
5858
)
5959
main_group.append(warning_text)
60-
display.show(main_group)
60+
display.root_group = main_group
6161
time.sleep(TIME_PAUSE)
6262

6363
text_area.text = "Testing Position"
6464
text_middle = label.Label(
6565
terminalio.FONT, text="Circuit", x=display.width // 2, y=display.height // 2
6666
)
6767
main_group.append(text_middle)
68-
display.show(main_group)
68+
display.root_group = main_group
6969
time.sleep(TIME_PAUSE)
7070

7171
# Testing Text Setter
7272
text_area.text = "Testing Changing Text"
7373
text_middle.text = "Python"
74-
display.show(main_group)
74+
display.root_group = main_group
7575
time.sleep(TIME_PAUSE)
7676

7777
# Testing a and y getter and setter
7878
text_area.text = "Testing Changing Position"
7979
text_middle.x = text_middle.x - 50
8080
text_middle.y = text_middle.y - 50
81-
display.show(main_group)
81+
display.root_group = main_group
8282
time.sleep(TIME_PAUSE)
8383

8484
# Testing font Getter and setter
8585
text_area.text = "Testing Changing FONT"
8686
if isinstance(text_middle.font, fontio.BuiltinFont):
8787
text_middle.font = MEDIUM_FONT
88-
display.show(main_group)
88+
display.root_group = main_group
8989
time.sleep(TIME_PAUSE)
9090

9191
# Once this working we create another label with all the initial specs
@@ -100,11 +100,11 @@
100100
y=display.height // 2,
101101
)
102102
main_group.append(text_initial_specs)
103-
display.show(main_group)
103+
display.root_group = main_group
104104
time.sleep(TIME_PAUSE)
105105

106106
text_initial_specs.color = 0x004400
107-
display.show(main_group)
107+
display.root_group = main_group
108108
time.sleep(TIME_PAUSE)
109109
main_group.pop()
110110

@@ -118,11 +118,11 @@
118118
color=0xFFFFFF,
119119
)
120120
main_group.append(text_initial_specs)
121-
display.show(main_group)
121+
display.root_group = main_group
122122
time.sleep(TIME_PAUSE)
123123

124124
text_initial_specs.background_color = 0x990099
125-
display.show(main_group)
125+
display.root_group = main_group
126126
time.sleep(TIME_PAUSE)
127127
main_group.pop()
128128

@@ -148,7 +148,7 @@
148148
background_tight=False,
149149
)
150150
main_group.append(text_initial_specs)
151-
display.show(main_group)
151+
display.root_group = main_group
152152
time.sleep(TIME_PAUSE)
153153
main_group.pop()
154154
main_group.pop()
@@ -168,7 +168,7 @@
168168
padding_left=10,
169169
)
170170
main_group.append(text_initial_specs)
171-
display.show(main_group)
171+
display.root_group = main_group
172172
time.sleep(TIME_PAUSE)
173173
main_group.pop()
174174

@@ -187,7 +187,7 @@
187187
padding_left=10,
188188
)
189189
main_group.append(text_initial_specs)
190-
display.show(main_group)
190+
display.root_group = main_group
191191
time.sleep(TIME_PAUSE)
192192

193193
try:
@@ -206,7 +206,7 @@
206206
)
207207
main_group.append(warning_text)
208208
time.sleep(TIME_PAUSE)
209-
display.show(main_group)
209+
display.root_group = main_group
210210

211211
main_group.pop()
212212

@@ -227,11 +227,11 @@
227227
anchor_point=(0.5, 0.5),
228228
)
229229
main_group.append(text_initial_specs)
230-
display.show(main_group)
230+
display.root_group = main_group
231231
time.sleep(TIME_PAUSE)
232232

233233
text_initial_specs.scale = 2
234-
display.show(main_group)
234+
display.root_group = main_group
235235
time.sleep(TIME_PAUSE)
236236
main_group.pop()
237237

@@ -257,7 +257,7 @@
257257
base_alignment=True,
258258
)
259259
main_group.append(text_initial_specs)
260-
display.show(main_group)
260+
display.root_group = main_group
261261
time.sleep(TIME_PAUSE)
262262
main_group.pop()
263263
main_group.pop()
@@ -280,7 +280,7 @@
280280
label_direction="UPR",
281281
)
282282
main_group.append(text_initial_specs)
283-
display.show(main_group)
283+
display.root_group = main_group
284284
time.sleep(TIME_PAUSE)
285285
main_group.pop()
286286

@@ -301,7 +301,7 @@
301301
label_direction="DWR",
302302
)
303303
main_group.append(text_initial_specs)
304-
display.show(main_group)
304+
display.root_group = main_group
305305
time.sleep(TIME_PAUSE)
306306
main_group.pop()
307307

@@ -322,7 +322,7 @@
322322
label_direction="TTB",
323323
)
324324
main_group.append(text_initial_specs)
325-
display.show(main_group)
325+
display.root_group = main_group
326326
time.sleep(TIME_PAUSE)
327327
main_group.pop()
328328

@@ -343,23 +343,23 @@
343343
label_direction="RTL",
344344
)
345345
main_group.append(text_initial_specs)
346-
display.show(main_group)
346+
display.root_group = main_group
347347
time.sleep(TIME_PAUSE)
348348
main_group.pop()
349349

350350
main_group.pop()
351351

352352
# Testing creating label with initial position
353-
display.show(main_group)
353+
display.root_group = main_group
354354
time.sleep(TIME_PAUSE)
355355
text_area = bitmap_label.Label(terminalio.FONT, text="Circuit Python")
356356
main_group.append(text_area)
357-
display.show(main_group)
357+
display.root_group = main_group
358358
time.sleep(TIME_PAUSE)
359359
# Testing position setter
360360
text_area.x = 10
361361
text_area.y = 10
362-
display.show(main_group)
362+
display.root_group = main_group
363363
time.sleep(TIME_PAUSE)
364364
text_area.text = "Testing initiating without text"
365365
try:
@@ -381,28 +381,28 @@
381381
terminalio.FONT, text="Circuit", x=display.width // 2, y=display.height // 2
382382
)
383383
main_group.append(text_middle)
384-
display.show(main_group)
384+
display.root_group = main_group
385385
time.sleep(TIME_PAUSE)
386386

387387
# Testing Text Setter
388388
text_area.text = "Testing Changing Text"
389389
text_middle.text = "Python"
390-
display.show(main_group)
390+
display.root_group = main_group
391391
time.sleep(TIME_PAUSE)
392392

393393
# Testing a and y getter and setter
394394
text_area.text = "Testing Changing Position"
395395
text_middle.x = text_middle.x - 50
396396
text_middle.y = text_middle.y - 50
397-
display.show(main_group)
397+
display.root_group = main_group
398398
time.sleep(TIME_PAUSE)
399399

400400
# Testing font Getter and setter
401401
text_area.text = "Testing Changing FONT"
402402
if isinstance(text_middle.font, fontio.BuiltinFont):
403403
print("Font was BuiltinFont")
404404
text_middle.font = MEDIUM_FONT
405-
display.show(main_group)
405+
display.root_group = main_group
406406
time.sleep(TIME_PAUSE)
407407

408408
# Once this working we create another label with all the initial specs
@@ -417,11 +417,11 @@
417417
y=display.height // 2,
418418
)
419419
main_group.append(text_initial_specs)
420-
display.show(main_group)
420+
display.root_group = main_group
421421
time.sleep(TIME_PAUSE)
422422

423423
text_initial_specs.color = 0x004400
424-
display.show(main_group)
424+
display.root_group = main_group
425425
time.sleep(TIME_PAUSE)
426426
main_group.pop()
427427

@@ -435,11 +435,11 @@
435435
color=0xFFFFFF,
436436
)
437437
main_group.append(text_initial_specs)
438-
display.show(main_group)
438+
display.root_group = main_group
439439
time.sleep(TIME_PAUSE)
440440

441441
text_initial_specs.background_color = 0x990099
442-
display.show(main_group)
442+
display.root_group = main_group
443443
time.sleep(TIME_PAUSE)
444444
main_group.pop()
445445

@@ -465,7 +465,7 @@
465465
background_tight=False,
466466
)
467467
main_group.append(text_initial_specs)
468-
display.show(main_group)
468+
display.root_group = main_group
469469
time.sleep(TIME_PAUSE)
470470
main_group.pop()
471471
main_group.pop()
@@ -485,7 +485,7 @@
485485
padding_left=10,
486486
)
487487
main_group.append(text_initial_specs)
488-
display.show(main_group)
488+
display.root_group = main_group
489489
time.sleep(TIME_PAUSE)
490490
main_group.pop()
491491

@@ -504,7 +504,7 @@
504504
padding_left=10,
505505
)
506506
main_group.append(text_initial_specs)
507-
display.show(main_group)
507+
display.root_group = main_group
508508
time.sleep(TIME_PAUSE)
509509

510510
try:
@@ -523,7 +523,7 @@
523523
)
524524
main_group.append(warning_text)
525525
time.sleep(TIME_PAUSE)
526-
display.show(main_group)
526+
display.root_group = main_group
527527

528528
main_group.pop()
529529

@@ -544,11 +544,11 @@
544544
anchor_point=(0.5, 0.5),
545545
)
546546
main_group.append(text_initial_specs)
547-
display.show(main_group)
547+
display.root_group = main_group
548548
time.sleep(TIME_PAUSE)
549549

550550
text_initial_specs.scale = 2
551-
display.show(main_group)
551+
display.root_group = main_group
552552
time.sleep(TIME_PAUSE)
553553
main_group.pop()
554554

@@ -574,7 +574,7 @@
574574
base_alignment=True,
575575
)
576576
main_group.append(text_initial_specs)
577-
display.show(main_group)
577+
display.root_group = main_group
578578
time.sleep(TIME_PAUSE)
579579
main_group.pop()
580580
main_group.pop()
@@ -597,7 +597,7 @@
597597
label_direction="UPR",
598598
)
599599
main_group.append(text_initial_specs)
600-
display.show(main_group)
600+
display.root_group = main_group
601601
time.sleep(TIME_PAUSE)
602602
main_group.pop()
603603

@@ -618,7 +618,7 @@
618618
label_direction="DWR",
619619
)
620620
main_group.append(text_initial_specs)
621-
display.show(main_group)
621+
display.root_group = main_group
622622
time.sleep(TIME_PAUSE)
623623
main_group.pop()
624624

@@ -639,7 +639,7 @@
639639
label_direction="UPD",
640640
)
641641
main_group.append(text_initial_specs)
642-
display.show(main_group)
642+
display.root_group = main_group
643643
time.sleep(TIME_PAUSE)
644644
main_group.pop()
645645

@@ -660,7 +660,7 @@
660660
label_direction="RTL",
661661
)
662662
main_group.append(text_initial_specs)
663-
display.show(main_group)
663+
display.root_group = main_group
664664
time.sleep(TIME_PAUSE)
665665
main_group.pop()
666666

examples/display_text_anchored_position.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
text_group.append(text_area_bottom_left)
6161
text_group.append(text_area_bottom_right)
6262

63-
board.DISPLAY.show(text_group)
63+
board.DISPLAY.root_group = text_group
6464

6565
while True:
6666
pass

examples/display_text_background_color.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
print("background color is {:06x}".format(text_area.background_color))
2020

21-
board.DISPLAY.show(text_area)
21+
board.DISPLAY.root_group = text_area
2222

2323
time.sleep(2)
2424
text_area.background_color = 0xFF0000

examples/display_text_background_color_padding.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
native_frames_per_second=90,
6868
)
6969

70-
display.show(None)
70+
display.root_group = None
7171

7272
# font=terminalio.FONT # this is the Builtin fixed dimension font
7373

@@ -82,7 +82,7 @@
8282

8383
display.auto_refresh = True
8484
myGroup = displayio.Group()
85-
display.show(myGroup)
85+
display.root_group = myGroup
8686

8787
text_area = []
8888
myPadding = 4

examples/display_text_bitmap_label_simpletest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
text_area = bitmap_label.Label(terminalio.FONT, text=text)
1111
text_area.x = 10
1212
text_area.y = 10
13-
board.DISPLAY.show(text_area)
13+
board.DISPLAY.root_group = text_area
1414
while True:
1515
pass

0 commit comments

Comments
 (0)