You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: micropython/examples/gfx_pack/README.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@
14
14
-[Wireless Examples](#wireless-examples)
15
15
-[Sunrise / Sunset](#sunrise--sunset)
16
16
-[Zoo Facts](#zoo-facts)
17
+
-[Other Resources](#other-resources)
17
18
18
19
## About Pico GFX Pack
19
20
@@ -122,4 +123,11 @@ Find out more about Zoo Animal API here: https://zoo-animal-api.herokuapp.com/
122
123
- D = Show stats
123
124
- E = Fetch a different 5 animals
124
125
126
+
## Other Resources
127
+
128
+
Here are some GFX Pack community projects and resources that you might find useful! Note that code at the links below has not been tested by us and we're not able to offer support with it.
129
+
130
+
-:link:[Octopus Energy Monitor](https://github.com/MaverickUK/OctopusEnergyMonitorPicoW)
Copy file name to clipboardExpand all lines: micropython/examples/pico_explorer/README.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,7 @@
12
12
-[Weather Station (BME68X)](#weather-station-bme68x)
13
13
-[Wireless Examples](#wireless-examples)
14
14
-[Cheerlights](#cheerlights)
15
+
-[Other Resources](#other-resources)
15
16
16
17
## PicoGraphics
17
18
@@ -64,10 +65,17 @@ Plug a [BME680](https://shop.pimoroni.com/products/bme680-breakout) or [BME688](
64
65
65
66
The wireless examples need `network_manager.py` and `WIFI_CONFIG.py` from the `common` directory to be saved to your Pico W. Open up `WIFI_CONFIG.py` in Thonny to add your wifi details (and save it when you're done).
66
67
67
-
You'll also need to install the `micropython-urllib.urequest` library using Thonny's 'Tools' > 'Manage Packages'.
68
+
You may also need to install the `micropython-urllib.urequest` library using Thonny's 'Tools' > 'Manage Packages'.
68
69
69
70
### Cheerlights
70
71
[cheerlights.py](cheerlights.py)
71
72
72
73
This Pico W example sets your Pico Explorer's screen (and optionally, a [RGB LED](https://shop.pimoroni.com/products/led-rgb-clear-common-cathode)) to the current #cheerlights colour.
73
74
75
+
## Other Resources
76
+
77
+
Here are some Pico Explorer community projects and resources that you might find useful! Note that code at the links below has not been tested by us and we're not able to offer support with it.
@@ -71,7 +74,7 @@ Bear in mind that MicroPython has only 192K of RAM available- a 320x240 pixel di
71
74
72
75
Both the Interstate75 and Interstate75W support lots of different sizes of HUB75 matrix displays.
73
76
74
-
The available display ssettings are listed here:
77
+
The available display settings are listed here:
75
78
76
79
* 32 x 32 Matrix - `DISPLAY_INTERSTATE75_32X32`
77
80
* 64 x 32 Matrix - `DISPLAY_INTERSTATE75_64X32`
@@ -267,6 +270,14 @@ If you are using a Galactic Unicorn, then the process for updating the display i
267
270
galactic_unicorn.update(display)
268
271
```
269
272
273
+
#### Get Bounds
274
+
275
+
You can use `get_bounds()` to get the width and height of the display - useful for writing code that's portable across different displays.
276
+
277
+
```python
278
+
WIDTH, HEIGHT= display.get_bounds()
279
+
```
280
+
270
281
### Text
271
282
272
283
#### Changing The Font
@@ -284,8 +295,8 @@ These are aligned from their top-left corner.
284
295
*`bitmap8`
285
296
*`bitmap14_outline`
286
297
287
-
Vector (Hershey) fonts.
288
-
These are aligned to their midline.
298
+
Vector (Hershey) fonts.
299
+
These are aligned horizontally (x) to their left edge, but vertically (y) to their midline excluding descenders [i.e., aligned at top edge of lower case letter m]. At `scale=1`, the top edge of upper case letters is 10 pixels above the specified `y`, text baseline is 10 pixels below the specified `y`, and descenders go down to 20 pixels below the specified `y`.
289
300
290
301
*`sans`
291
302
*`gothic`
@@ -347,7 +358,7 @@ Draws an ampersand in a 16px tall, 2x scaled version of the 'bitmap8' font.
347
358
348
359
#### Line
349
360
350
-
To draw a line:
361
+
To draw a straight line at any angle between two specified points:
351
362
352
363
```python
353
364
display.line(x1, y1, x2, y2)
@@ -412,12 +423,14 @@ Setting individual pixels is slow, but you can do it with:
412
423
display.pixel(x, y)
413
424
```
414
425
415
-
You can set a horiontal span of pixels a little faster with:
426
+
You can draw a horizontal span of pixels a little faster with:
416
427
417
428
```python
418
-
pixel_span(x, y, length)
429
+
display.pixel_span(x, y, length)
419
430
```
420
431
432
+
(use `display.line()` instead if you want to draw a straight line at any angle)
433
+
421
434
### Palette Management
422
435
423
436
Intended for P4 and P8 modes.
@@ -427,7 +440,7 @@ You have a 16-color and 256-color palette respectively.
427
440
Set n elements in the palette from a list of RGB tuples:
428
441
429
442
```python
430
-
set_palette([
443
+
display.set_palette([
431
444
(r, g, b),
432
445
(r, g, b),
433
446
(r, g, b)
@@ -437,15 +450,15 @@ set_palette([
437
450
Update an entry in the P4 or P8 palette with the given colour.
438
451
439
452
```python
440
-
update_pen(index, r, g, b)
453
+
display.update_pen(index, r, g, b)
441
454
```
442
455
443
456
This is stored internally as RGB and converted to whatever format your screen requires when displayed.
444
457
445
458
Reset a pen back to its default value (black, marked unused):
0 commit comments