Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
HepiaLight3 - RBPi Pico
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
michael.divia
HepiaLight3 - RBPi Pico
Commits
c7f1f3f6
Commit
c7f1f3f6
authored
1 year ago
by
michael.divia
Browse files
Options
Downloads
Patches
Plain Diff
Forgot the function
parent
d14be82c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
1 - Code/hl3.py
+41
-14
41 additions, 14 deletions
1 - Code/hl3.py
1 - Code/main.py
+3
-3
3 additions, 3 deletions
1 - Code/main.py
with
44 additions
and
17 deletions
1 - Code/hl3.py
+
41
−
14
View file @
c7f1f3f6
...
@@ -45,8 +45,7 @@ class color:
...
@@ -45,8 +45,7 @@ class color:
def
col
(
r
,
g
,
b
):
def
col
(
r
,
g
,
b
):
return
(
r
,
g
,
b
)
return
(
r
,
g
,
b
)
class
matrix
:
def
color_convert
(
color
):
def
clear
(
color
):
# Handle hex an 0
# Handle hex an 0
if
isinstance
(
color
,
int
):
if
isinstance
(
color
,
int
):
...
@@ -61,7 +60,35 @@ class matrix:
...
@@ -61,7 +60,35 @@ class matrix:
else
:
else
:
raise
ValueError
(
"
Color must be an RGB tuple, a hex value, 0 or a valide color from the color class
"
)
raise
ValueError
(
"
Color must be an RGB tuple, a hex value, 0 or a valide color from the color class
"
)
return
color
class
matrix
:
def
clear
(
color
):
# Convert the color
color
=
color_convert
(
color
)
# Set the full screen to the color
for
i
in
range
(
nb_line
*
nb_row
):
for
i
in
range
(
nb_line
*
nb_row
):
np
[
i
]
=
color
np
[
i
]
=
color
# Apply the array
np
.
write
()
np
.
write
()
def
set_line
(
line
,
color
):
# Check line
if
line
<
0
or
line
>=
nb_line
:
raise
ValueError
(
"
Line is out of bound
"
)
# Convert the color
color
=
color_convert
(
color
)
# Set the line to the color
for
i
in
range
(
line
*
nb_row
,
(
line
*
nb_row
)
+
nb_row
):
np
[
i
]
=
color
# Apply the array
np
.
write
()
This diff is collapsed.
Click to expand it.
1 - Code/main.py
+
3
−
3
View file @
c7f1f3f6
from
hl3
import
color
from
hl3
import
*
from
hl3
import
matrix
matrix
.
clear
(
color
.
RED
)
matrix
.
clear
(
0
)
matrix
.
set_line
(
5
,
color
.
RED
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment