From 24e609f8df468fa26e4fcd3855ac79f305607be0 Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Thu, 2 Nov 2023 00:47:46 -0400 Subject: [PATCH 1/2] Replace depreciated .show() --- adafruit_display_shapes/sparkline.py | 2 +- examples/display_shapes_circle_animation.py | 2 +- examples/display_shapes_simpletest.py | 2 +- examples/display_shapes_simpletest_magtag.py | 2 +- examples/display_shapes_sparkline_simpletest.py | 6 +++--- examples/display_shapes_sparkline_ticks.py | 6 +++--- examples/display_shapes_sparkline_triple.py | 6 +++--- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/adafruit_display_shapes/sparkline.py b/adafruit_display_shapes/sparkline.py index 1efbc29..d359a06 100644 --- a/adafruit_display_shapes/sparkline.py +++ b/adafruit_display_shapes/sparkline.py @@ -11,7 +11,7 @@ # add_value` are plotted. # # The `sparkline` class creates an element suitable for adding to the display using -# `display.show(mySparkline)` +# `display.root_group=mySparkline` # or adding to a `displayio.Group` to be displayed. # # When creating the sparkline, identify the number of `max_items` that will be diff --git a/examples/display_shapes_circle_animation.py b/examples/display_shapes_circle_animation.py index 1ccedda..f82d9be 100644 --- a/examples/display_shapes_circle_animation.py +++ b/examples/display_shapes_circle_animation.py @@ -40,7 +40,7 @@ delta_y = 2 # Showing the items on the screen -display.show(main_group) +display.root_group = main_group while True: if circle.y + circle_radius >= display.height - circle_radius: diff --git a/examples/display_shapes_simpletest.py b/examples/display_shapes_simpletest.py index 016cd2b..52dd7e2 100644 --- a/examples/display_shapes_simpletest.py +++ b/examples/display_shapes_simpletest.py @@ -12,7 +12,7 @@ # Make the display context splash = displayio.Group() -board.DISPLAY.show(splash) +board.DISPLAY.root_group = splash # Make a background color fill color_bitmap = displayio.Bitmap(320, 240, 1) diff --git a/examples/display_shapes_simpletest_magtag.py b/examples/display_shapes_simpletest_magtag.py index ae007b7..1dc58fd 100644 --- a/examples/display_shapes_simpletest_magtag.py +++ b/examples/display_shapes_simpletest_magtag.py @@ -17,7 +17,7 @@ # Make the display context splash = displayio.Group() -display.show(splash) +display.root_group = splash # Make a background color fill color_bitmap = displayio.Bitmap(display.width, display.height, 1) diff --git a/examples/display_shapes_sparkline_simpletest.py b/examples/display_shapes_sparkline_simpletest.py index 1f02586..e6f5e09 100755 --- a/examples/display_shapes_sparkline_simpletest.py +++ b/examples/display_shapes_sparkline_simpletest.py @@ -11,7 +11,7 @@ # `add_value` are plotted. # # The `sparkline` class creates an element suitable for adding to the display using -# `display.show(mySparkline)` +# `display.root_group=mySparkline` # or adding to a `displayio.Group` to be displayed. # # When creating the sparkline, identify the number of `max_items` that will be @@ -85,7 +85,7 @@ ) # reset the display to show nothing. - display.show(None) + display.root_group = None else: # built-in display display = board.DISPLAY @@ -117,7 +117,7 @@ # Add my_group (containing the sparkline) to the display -display.show(my_group) +display.root_group = my_group # Start the main loop while True: diff --git a/examples/display_shapes_sparkline_ticks.py b/examples/display_shapes_sparkline_ticks.py index c377376..13e4e04 100755 --- a/examples/display_shapes_sparkline_ticks.py +++ b/examples/display_shapes_sparkline_ticks.py @@ -11,7 +11,7 @@ # using `add_value` are plotted. # # The `sparkline` class creates an element suitable for adding to the display -# using `display.show(mySparkline)` or adding to a `displayio.Group` to be displayed. +# using `display.root_group=mySparkline` or adding to a `displayio.Group` to be displayed. # # When creating the sparkline, identify the number of `max_items` that will be # included in the graph. @@ -86,7 +86,7 @@ ) # reset the display to show nothing. - display.show(None) + display.root_group = None else: # built-in display display = board.DISPLAY @@ -171,7 +171,7 @@ # Set the display to show my_group that contains the sparkline and other graphics -display.show(my_group) +display.root_group = my_group # Start the main loop while True: diff --git a/examples/display_shapes_sparkline_triple.py b/examples/display_shapes_sparkline_triple.py index 348724a..01197a9 100755 --- a/examples/display_shapes_sparkline_triple.py +++ b/examples/display_shapes_sparkline_triple.py @@ -11,7 +11,7 @@ # using `add_value` are plotted. # # The `sparkline` class creates an element suitable for adding to the display -# using `display.show(mySparkline)` or adding to a `displayio.Group` to be displayed. +# using `display.root_group=mySparkline` or adding to a `displayio.Group` to be displayed. # # When creating the sparkline, identify the number of `max_items` that will be # included in the graph. @@ -84,7 +84,7 @@ ) # reset the display to show nothing. - display.show(None) + display.root_group = None else: # built-in display display = board.DISPLAY @@ -219,7 +219,7 @@ # Set the display to show my_group that contains all the bitmap TileGrids and # sparklines -display.show(my_group) +display.root_group = my_group i = 0 # This is a counter for changing the random values for mySparkline3 From 7b3d559a1e7046ef8d434c6495768d632d8b3620 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 2 Nov 2023 08:56:26 -0400 Subject: [PATCH 2/2] Apply suggestions from code review --- adafruit_display_shapes/sparkline.py | 2 +- examples/display_shapes_sparkline_simpletest.py | 2 +- examples/display_shapes_sparkline_ticks.py | 2 +- examples/display_shapes_sparkline_triple.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/adafruit_display_shapes/sparkline.py b/adafruit_display_shapes/sparkline.py index d359a06..d37b98b 100644 --- a/adafruit_display_shapes/sparkline.py +++ b/adafruit_display_shapes/sparkline.py @@ -11,7 +11,7 @@ # add_value` are plotted. # # The `sparkline` class creates an element suitable for adding to the display using -# `display.root_group=mySparkline` +# `display.root_group = mySparkline` # or adding to a `displayio.Group` to be displayed. # # When creating the sparkline, identify the number of `max_items` that will be diff --git a/examples/display_shapes_sparkline_simpletest.py b/examples/display_shapes_sparkline_simpletest.py index e6f5e09..cff1e6b 100755 --- a/examples/display_shapes_sparkline_simpletest.py +++ b/examples/display_shapes_sparkline_simpletest.py @@ -11,7 +11,7 @@ # `add_value` are plotted. # # The `sparkline` class creates an element suitable for adding to the display using -# `display.root_group=mySparkline` +# `display.root_group = mySparkline` # or adding to a `displayio.Group` to be displayed. # # When creating the sparkline, identify the number of `max_items` that will be diff --git a/examples/display_shapes_sparkline_ticks.py b/examples/display_shapes_sparkline_ticks.py index 13e4e04..a2bb533 100755 --- a/examples/display_shapes_sparkline_ticks.py +++ b/examples/display_shapes_sparkline_ticks.py @@ -11,7 +11,7 @@ # using `add_value` are plotted. # # The `sparkline` class creates an element suitable for adding to the display -# using `display.root_group=mySparkline` or adding to a `displayio.Group` to be displayed. +# using `display.root_group = mySparkline` or adding to a `displayio.Group` to be displayed. # # When creating the sparkline, identify the number of `max_items` that will be # included in the graph. diff --git a/examples/display_shapes_sparkline_triple.py b/examples/display_shapes_sparkline_triple.py index 01197a9..53c4f69 100755 --- a/examples/display_shapes_sparkline_triple.py +++ b/examples/display_shapes_sparkline_triple.py @@ -11,7 +11,7 @@ # using `add_value` are plotted. # # The `sparkline` class creates an element suitable for adding to the display -# using `display.root_group=mySparkline` or adding to a `displayio.Group` to be displayed. +# using `display.root_group = mySparkline` or adding to a `displayio.Group` to be displayed. # # When creating the sparkline, identify the number of `max_items` that will be # included in the graph.