GraphicsBase line_thickness interface¶
This page explains the GraphicsBase
class line_thickness
property interface.
What interface is this?¶
The line_thickness
property interface updates or get the instance’s line thickness (line width).
Basic usage¶
The getter or setter interface value becomes (or requires) the Int
value.
The following example sets the 5-pixel line thickness to the first rectangle and the 10-pixel line thickness to the second one:
import apysc as ap
ap.Stage(
stage_width=250,
stage_height=150,
background_color=ap.Color("#333"),
stage_elem_id="stage",
)
sprite: ap.Sprite = ap.Sprite()
sprite.graphics.line_style(color=ap.Color("#0af"), thickness=1)
rectangle_1: ap.Rectangle = sprite.graphics.draw_rect(x=50, y=50, width=50, height=50)
rectangle_1.line_thickness = ap.Int(5)
rectangle_2: ap.Rectangle = sprite.graphics.draw_rect(x=150, y=50, width=50, height=50)
rectangle_2.line_thickness = ap.Int(10)
ap.save_overall_html(dest_dir_path="./graphics_base_line_thickness_basic_usage/")
line_thickness property API¶
Note: the document build script generates and updates this API document section automatically. Maybe this section is duplicated compared with previous sections.
[Interface summary]
Get this instance’s line thickness.
[Returns]
line_thickness
: IntCurrent line thickness.
[Examples]
>>> import apysc as ap
>>> stage: ap.Stage = ap.Stage()
>>> sprite: ap.Sprite = ap.Sprite()
>>> sprite.graphics.line_style(color=ap.Color("#fff"), thickness=5)
>>> line: ap.Line = sprite.graphics.draw_line(
... x_start=50, y_start=50, x_end=150, y_end=50
... )
>>> line.line_thickness
Int(5)