Embedded code for CircuitPython projects will show up in the Learn Guide with a Download Project Bundle button as shown below.
This allows downloading a single .zip file which contains the code, libraries, and any assets, like fonts, images, etc. No need to download different pieces from separate locations. It's one stop shopping!
In order for this feature to work, a specific file naming and folder layout scheme is required. In general:
- place code listing in a file named code.py in project folder
- place images in a subfolder named /images
- place fonts in a subfolder named /fonts
Below is more specific information for different scenarios with example folder layouts.
Single Code Without Assets
This is the simplest case. There is only one code involved for the project and no assets (images, fonts, etc.) are used. Just place the code in a file named code.py in the project folder.
Adafruit_Learning_System_Guides │ ├── Project Folder │ │ └── code.py
Multiple Codes Without Assets
Some Learn Guides will have more than one code listing. In that case, the filename code.py is still used for each, but they are placed in subfolders. The subfolder names can be anything.
Adafruit_Learning_System_Guides │ ├── Project Folder │ │ └── example1 │ │ │ └── code.py │ │ ├── example2 │ │ │ └── code.py
Single Code With Assets
If the project code ends up using assets like images or fonts, these must be placed in specific subfolders.
- /images - put images here
- /fonts - put custom fonts here
Multiple image and font files can be placed in the subfolders. They can also be named anything.
Adafruit_Learning_System_Guides │ ├── Project Folder │ │ └── images │ │ │ └── cat.bmp │ │ └── fonts │ │ │ └── bold_font.bdf │ │ └── code.py
Multiple Codes With Assets
This is essentially the same as the previous section. However, each code and its associated assets are placed in subfolders. If the same asset is used in multiple code examples, a separate copy must be placed in the subfolders. There is currently no way to provide a "shared" assets layout.
Adafruit_Learning_System_Guides │ ├── Project Folder │ │ └── example1 │ │ │ └── images │ │ │ │ └── cat.bmp │ │ │ └── fonts │ │ │ │ └── bold_font.bdf │ │ │ └── code.py │ │ └── example2 │ │ │ └── images │ │ │ │ └── cat.bmp │ │ │ └── fonts │ │ │ │ └── bold_font.bdf │ │ │ └── code.py
Adafruit_Learning_System_Guides │ ├── Project Folder │ │ └── secrets.py │ │ └── code.py
Page last edited March 08, 2024
Text editor powered by tinymce.