Python libremarkable#
- libremarkable.deviceType: DeviceType#
Current device type
- libremarkable.Framebuffer: libremarkable._framebuffer.FrameBuffer#
Framebuffer API instance
- class libremarkable._framebuffer.FrameBuffer#
Bases:
object
Framebuffer
- classmethod __contains__(color)#
Check to see if a colour is present in the framebuffer memory
- classmethod __getitem__(key)#
Get data from the framebuffer memory
- __init__()#
- classmethod __iter__()#
Iterate through the framebuffer memory
- Return type:
iter
- classmethod __setitem__(key, value)#
Set framebuffer memory
- classmethod draw_image(left, top, image)#
Draw an image into the framebufffer memory
- classmethod draw_line(x1, y1, x2, y2, color)#
Draw a line between two points in the framebuffer memory
- classmethod draw_multiline_text(left, top, width, height, text, color='black', fontSize=24, align='left')#
Draw multiline text on the framebuffer memory
- Parameters:
- classmethod draw_rect(left, top, right, bottom, color, lineSize=1)#
Draw a rectangle in the framebuffer memory
- classmethod draw_text(left, top, width, height, text, color='black', fontSize=24)#
Draw text on the framebuffer memory
- classmethod get_offset(x, y)#
Get the offset of a x,y on the framebuffer
- classmethod get_pixel(x, y)#
Get the value for a pixel in the framebuffer memory
- classmethod get_row(x, y, width)#
Get the data for a row in the framebuffer memory
- classmethod get_row_offset(y)#
Get the offset of a row on the framebuffer
- static getcolor(name_or_hex)#
Get the value for a colour name or hex
- Name_or_hex:
colour name of hex
- Return type:
- Returns:
colour value
- classmethod mmap()#
memory map the framebuffer
- classmethod open()#
Open the framebuffer
- static path()#
Path to framebuffer device
- static release()#
Release the framebuffer
- classmethod set_col(x, y, height, color)#
Set a column in the framebuffer memory to a colour
- classmethod set_color(color)#
Set the framebuffer memory to a colour
- classmethod set_pixel(x, y, color)#
Set a pixel in the framebuffer memory to a colour
- classmethod set_rect(left, top, width, height, color)#
Set a rectangle in the framebuffer memory to a colour
- classmethod set_row(x, y, width, color)#
Set a row in the framebuffer memory to a colour
- classmethod to_image(left=0, top=0, width=None, height=None)#
Get an image of the framebuffer memory
- classmethod update(x, y, width, height, waveform, marker=None, partial=True, sync=False)#
Update a portion of the screen with the contents of the framebuffer memory
- Parameters:
x (
int
) – x coordinate of area to updatey (
int
) – y coordinate of area to updatewidth (
int
) – width of area to updateheight (
int
) – height of area to updatewaveform (
WaveformMode
) – Waveform to use for the updatemarker (
int
) – Update Markerpartial (
bool
) – Partial or full screen updatesync (
bool
) – Perform update synchronously
- Return type:
- Returns:
Update marker
- classmethod update_full(waveform, marker=None, sync=False)#
Update the screen with the contents of the framebuffer memory
- Parameters:
waveform (
WaveformMode
) – Waveform to use for the updatemarker (
int
) – Update Markersync (
bool
) – Perform update synchronously
- Return type:
- Returns:
Update marker
- static wait(marker)#
Wait for an update to finish
- __weakref__#
list of weak references to the object
- class libremarkable.DeviceType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#
- RM1 = 2#
reMarkable 1
- RM2 = 3#
reMarkable 2
- RMPP = 4#
reMarkable Paper Pro
- UNKNOWN = 1#
Unknown device
- class libremarkable.Event(device, state)#
Input event
- __init__(device, state)#
- __repr__()#
Return repr(self).
- __weakref__#
list of weak references to the object
- data#
Current event data
- device#
Event device
- previousData#
Previous event data
- rawEvents#
Raw events
- class libremarkable.Input#
Input API
- classmethod deviceType(device)#
Gets the string representation of the device type for an input device
- Return type:
- Returns:
key, wacom, touch, or unknown
- classmethod devices()#
Input devices
- Return type:
- classmethod events(block=False)#
Listen for input events
- classmethod keyDevices()#
Input devices that support EV_KEY
- Return type:
- classmethod keyboards()#
Keyboard input devices
- Return type:
- classmethod physicalKeyboards()#
Physical keyboards
- Return type:
- classmethod positionDevices()#
Input devices that support EV_ABS
- Return type:
- classmethod rawEvents(devices=None, block=False)#
Get the raw events for input devices
- Parameters:
devices (
list
[InputDevice
]) – Optional list of devices to listen toblock (
bool
) – If listening should block until events are recieved. If you are not blocking, you will recieve an empty event every 100ms if no event happens
- Return type:
Iterator
[tuple
[InputDevice
|None
,list
[InputEvent
]]]- Returns:
Generator of events
- classmethod rawKeyEvents(block=False)#
Get the raw events for key input devices
- Parameters:
block (
bool
) – If listening should block until events are recieved. If you are not blocking, you will recieve an empty event every 100ms if no event happens- Return type:
Iterator
[tuple
[InputDevice
,InputEvent
] |tuple
[None
,None
]]- Returns:
Generator of events
- classmethod rawPositionEvents(block=False)#
Get the raw events for position input devices
- Parameters:
block (
bool
) – If listening should block until events are recieved. If you are not blocking, you will recieve an empty event every 100ms if no event happens- Return type:
Iterator
[tuple
[InputDevice
,InputEvent
] |tuple
[None
,None
]]- Returns:
Generator of events
- classmethod rawTouchEvents(block=False)#
Get the raw events for touch input devices
- Parameters:
block (
bool
) – If listening should block until events are recieved. If you are not blocking, you will recieve an empty event every 100ms if no event happens- Return type:
Iterator
[tuple
[InputDevice
,InputEvent
] |tuple
[None
,None
]]- Returns:
Generator of events
- classmethod rawWacomEvents(block=False)#
Get the raw events for tablet input devices
- Parameters:
block (
bool
) – If listening should block until events are recieved. If you are not blocking, you will recieve an empty event every 100ms if no event happens- Return type:
Iterator
[tuple
[InputDevice
,InputEvent
] |tuple
[None
,None
]]- Returns:
Generator of events
- classmethod touchDevices()#
Input devices that support multitouch
- Return type:
- classmethod virtualKeyboards()#
Keyboards that are vitual
- Return type:
- classmethod wacomDevices()#
Input devices that use a stylus
- Return type:
- __weakref__#
list of weak references to the object
- class libremarkable.KeyEvent(device, state)#
- __init__(device, state)#
- __repr__()#
Return repr(self).
- class libremarkable.Orientation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#
- LANDSCAPE = 3#
Landscape
- PORTRAIT = 2#
Portrait
- UNKNOWN = 1#
Unknown orientation
- class libremarkable.TouchEvent(device, state)#
Touch Event
- __init__(device, state)#
- __repr__()#
Return repr(self).
- class libremarkable.WacomEvent(device, state)#
Tablet Event
- __init__(device, state)#
- __repr__()#
Return repr(self).
- class libremarkable.WaveformMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#
Waveform mode to use during an update
- __format__(format_spec, /)#
Default object formatter.
- __new__(value)#
- Grayscale = 3#
Grayscale mode
- HighQualityGrayscale = 2#
High quality mode
- Highlight = 8#
Highlight mode
- Initialize = 0#
Initialize the framebuffer
- Mono = 1#
Black and white mode
- libremarkable.orientation()#
Get the current device orientation
- Return type:
- class libremarkable.geometry.Point(x, y)#
Point on a 2d plane
- __eq__(other)#
Return self==value.
- __hash__()#
Return hash(self).
- __init__(x, y)#
- __iter__()#
Iterate through the x and then y coordinate
- __lt__(point)#
Check to see if one point is less than another point
- __repr__()#
Return repr(self).
- toInt()#
Return a clone of this point after converting the x and y coordinates to integers
- Return type:
- __weakref__#
list of weak references to the object
- class libremarkable.geometry.Rect(left, top, right, bottom)#
A rectangle on a 2d plane
- __and__(rect)#
See
intersect()
- __contains__(point: libremarkable.geometry.Point)#
- __contains__(rect: libremarkable.geometry.Rect)
- __contains__(item)
If the rectangle contains a point or a rect
- __eq__(other)#
Return self==value.
- __hash__()#
Return hash(self).
- __init__(left, top, right, bottom)#
- __iter__()#
Iterate through the left, top, right, and then bottom of the rectangle :rtype:
Iterable
[float
] :return: left, top, right, then bottom of the rectangle
- __repr__()#
Return repr(self).
- __sub__(rect)#
See
difference()
- __xor__(rect)#
Returns the region without the
intersect()
of rect
- difference(rect)#
Returns the difference of this rectangle and another rectangle
- intersect(rect)#
Returns the intersection of this rectangle and another rectangle
- intersects(rect)#
Check if a rectangle intersects this rectangle
- resize(width, height)#
resize the rectangle to a specific width and height, this resizes with topRight as the anchor-point
- Parameters:
with – new width of the rect
height (
float
) – new height of the rect
- resized(width, height)#
Clone the rect and then resize it to a specific width and height with the topRight as the anchor-point
- toInt()#
Clone and return a rect where left, top, right, and bottom have been converted into integers :rtype:
Rect
:return: Cloned rectangle with integer coordinates
- translate(x, y)#
Move the rectangle on the 2d plane
- translated(x, y)#
Clone the rect and then translate it on a 2d plane
- __weakref__#
list of weak references to the object
- class libremarkable.geometry.Region(*rects)#
A collection of rectangles
- __add__(rect: libremarkable.geometry.Rect)#
- __add__(rects: Iterable[libremarkable.geometry.Rect])
- __add__(region: libremarkable.geometry.Region)
- __add__(item)
Create a clone that adds one or more rect or a region to this region
- __contains__(point: libremarkable.geometry.Point)#
- __contains__(rect: libremarkable.geometry.Rect)
- __contains__(region: libremarkable.geometry.Region)
- __contains__(item)
Checks if a point, rect, or region is contained in this region
- __iadd__(rect: libremarkable.geometry.Rect)#
- __iadd__(rect: Iterable[libremarkable.geometry.Rect])
- __iadd__(region: libremarkable.geometry.Region)
- __iadd__(item)
Add a rect or region to this region
- __init__(*rects)#
Create a new instance
- __isub__(rect: libremarkable.geometry.Rect)#
- __isub__(rect: Iterable[libremarkable.geometry.Rect])
- __isub__(region: libremarkable.geometry.Region)
- __isub__(item)
Remove a rect or region from this region
- __sub__(rect: libremarkable.geometry.Rect)#
- __sub__(rect: Iterable[libremarkable.geometry.Rect])
- __sub__(region: libremarkable.geometry.Region)
- __sub__(item)
Create a clone of the region and then remove the rect(s) from the clone
- __weakref__#
list of weak references to the object
- elements#
Rectangles that make up the region