mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 01:24:17 +00:00
pybricks/resources/image: add show_image() method
This commit is contained in:
@@ -47,6 +47,8 @@
|
||||
|
||||
.. automethod:: pybricks.hubs::EV3Brick.screen.set_font
|
||||
|
||||
.. automethod:: pybricks.hubs::EV3Brick.screen.show_image
|
||||
|
||||
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_image
|
||||
|
||||
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_pixel
|
||||
|
||||
@@ -10,9 +10,6 @@ Graphical Images
|
||||
.. autoclass:: pybricks.resources.Image
|
||||
:no-members:
|
||||
|
||||
.. automethod:: pybricks.resources.Image.clear
|
||||
|
||||
|
||||
.. rubric:: Drawing Text
|
||||
|
||||
There are two ways to draw text on images. :meth:`draw_text` lets text be
|
||||
@@ -55,6 +52,13 @@ Graphical Images
|
||||
.. autoattribute:: pybricks.resources.Image.height
|
||||
|
||||
|
||||
.. rubric:: Replacing the Entire Image
|
||||
|
||||
.. automethod:: pybricks.resources.Image.clear
|
||||
|
||||
.. automethod:: pybricks.resources.Image.show_image
|
||||
|
||||
|
||||
Fonts
|
||||
^^^^^
|
||||
|
||||
|
||||
@@ -288,6 +288,8 @@ def find_obj(self, env, modname, classname, name, type, searchmode=0):
|
||||
if classname == 'screen':
|
||||
if name.startswith('Font.') or name == 'Font':
|
||||
modname = 'pybricks.resources'
|
||||
elif name.startswith('Image.') or name == 'Image':
|
||||
modname = 'pybricks.resources'
|
||||
else:
|
||||
classname = 'EV3Brick.screen'
|
||||
elif classname == 'speaker':
|
||||
|
||||
+1
-1
Submodule pybricks-projects updated: d646e0fc49...37ca78217f
@@ -114,6 +114,15 @@ class Image:
|
||||
no transparency.
|
||||
"""
|
||||
|
||||
def show_image(self, source):
|
||||
"""Clears this image, then draws ``source`` centered in this image.
|
||||
|
||||
Arguments:
|
||||
source (Image or str):
|
||||
The source :class:`Image`. If the argument is a string, then
|
||||
the ``source`` image is loaded from file.
|
||||
"""
|
||||
|
||||
def draw_text(self, x, y, text, color=Color.BLACK):
|
||||
"""Draws text on the image.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user