-
Notifications
You must be signed in to change notification settings - Fork 2
Merge in code from Adafruit_CircuitPython_DisplayIO_Layout v1.17.0 #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
baf6cb4
Merge Cartesian from Adafruit_CircuitPython_DisplayIO_Layout v1.17.0
tekktrik c351c76
Add example file for plotting lines
tekktrik dc2874f
Update library name for import in example files
tekktrik 58fccfa
Add end of line character
tekktrik f6a5d81
Fix capital letter for Cartesian reference
tekktrik 037c538
Fix import in code block
tekktrik 890ee2c
Fix type annotation for _calc_local_xy
tekktrik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# SPDX-FileCopyrightText: 2021 Stefan Krüger | ||
# | ||
# SPDX-License-Identifier: MIT | ||
############################# | ||
""" | ||
This is a basic demonstration of a Cartesian widget for line-ploting | ||
""" | ||
|
||
import time | ||
import board | ||
import displayio | ||
from displayio_cartesian import Cartesian | ||
|
||
# create the display on the PyPortal or Clue or PyBadge(for example) | ||
display = board.DISPLAY | ||
# otherwise change this to setup the display | ||
# for display chip driver and pinout you have (e.g. ILI9341) | ||
|
||
# pybadge display: 160x128 | ||
# Create a Cartesian widget | ||
# https://circuitpython.readthedocs.io/projects/displayio-layout/en/latest/api.html#module-adafruit_displayio_layout.widgets.cartesian | ||
my_plane = Cartesian( | ||
x=15, # x position for the plane | ||
y=2, # y plane position | ||
width=140, # display width | ||
height=105, # display height | ||
xrange=(0, 10), # x range | ||
yrange=(0, 10), # y range | ||
) | ||
|
||
my_group = displayio.Group() | ||
my_group.append(my_plane) | ||
display.show(my_group) # add high level Group to the display | ||
|
||
data = [ | ||
# (0, 0), # we do this point manually - so we have no wait... | ||
(1, 1), | ||
(2, 1), | ||
(2, 2), | ||
(3, 3), | ||
(4, 3), | ||
(4, 4), | ||
(5, 5), | ||
(6, 5), | ||
(6, 6), | ||
(7, 7), | ||
(8, 7), | ||
(8, 8), | ||
(9, 9), | ||
(10, 9), | ||
(10, 10), | ||
] | ||
|
||
print("examples/displayio_layout_cartesian_lineplot.py") | ||
|
||
# first point without a wait. | ||
my_plane.add_plot_line(0, 0) | ||
for x, y in data: | ||
my_plane.add_plot_line(x, y) | ||
time.sleep(0.5) | ||
|
||
while True: | ||
pass |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.