-
-
Notifications
You must be signed in to change notification settings - Fork 129
Home
Although this software was written specifically for the 7.5" E-Paper (640x384) display from waveshare/gooddisplay, support for more E-Paper displays has been added. At the moment, the following E-Papers are supported:
- 4.2" E-Paper black-white
- 4.2" E-Paper black-white-red/yellow
- 5.83" E-Paper black-white
- 5.83" E-Paper black-white-red/yellow
- 7.5" E-Paper black-white (640x384px)
- 7.5" E-Paper black-white-red/yellow (640x384px)
- 7.5" E-Paper black-white (800x400px)
- 7.5" E-Paper black-white-red/yellow (800x400px)
The following functions have been written especially for the E-Paper display to make it easier to do certain things, which otherwise would be too complex.
get_tz()
This function grabs the timezone set by raspi-config (system timezone). This is useful if you're tinkering with any date/time related applications e.g. iCalendar or a normal monthly calendar.
Example:
Current time: arrow.now()
Current time with timezone: arrow.now(tz = get_tz())
write_text(parameters)
As the name suggests, this function allows writing text on the Image. While this function does look complicated, it's normal usage is not at all complicated. Let's take a look at the full function:
def write_text(space_width, space_height, text, tuple, font=default, alignment='middle', autofit = False, fill_width = 1.0, fill_height = 0.8, colour = text_colour, rotation = None)
To make it simpler to understand, let's omit the optional stuff:
def write_text(space_width, space_height, text, tuple)
What this function really does is creating an empty (white) text-box of given width and height. Then, it adds the text you want to add inside that box. If anything does not fit, it'll be made to fit in the text box by chopping letters off from the end of that word/sentence. At the moment, the function doesn't know where to add your text. Therefore, the last parameter that is required is the position on the display. The position is a tuple representing the coordinates (x,y), where (0,0) is the top left corner of the E-Paper.
Here's an example:
You want to add 'Hello World' at the top left corner of the E-Paper:
write_text(100, 20, 'Hello World!', (0,0))
This will create a text-box with a width of 100 and height of 20, add the text and place it at the top-left corner of the display.
internet_available()
This function is checks if the internet is available at the moment. It returns True
if internet is available and False
if the internet could not be reached. This is pretty useful when you're making a module that uses something from the internet as it can be used to prevent code executions if the internet is not available.
clear_image(section)
As the Inky-Calendar software does not use a blank image every time, it is required to 'erase' the current image. Image having just one page of paper. If you want to re-use the paper, you'd have to erase what you wrote on it before. This function does the same. Please head to the section writing your own module for more information.
Usage:
section refers to either 'top section'
or 'middle_section'
or 'bottom section'
, whichever one you're using.
clear_image('middle_section')
will erase the current contents of the middle section.
crop_image(input_image, section)
As the software starts off with an image having the same size as the display, a function was required to 'cut' the image into pieces (or in this case, sections). After you've finished adding content on the section you've been working with, this function will crop the image to the dimensions of the section. Please head to the section writing your own module for more information.
Usage:
section refers to either 'top section'
or 'middle_section'
or 'bottom section'
, whichever one you're using.
crop_image(image, 'top_section')
Will crop the image to the size of the top-section.
Inkycal Project of aceinnolab Copyright © (2018-2024)