Skip to content

Missing zorder? #22

@jankaWIS

Description

@jankaWIS

Hi @mwshinn ,

Maybe I have missed it, but I cannot find zorder. How can I specify the order of items plot on canvas? Let's take the following example. I want to load and add an image and on top of it place text. I can do it by creating a separate unitname and then add the text there (middle image). But what if I want to add the text relative to the canvas like in the example of the left image? I still want the text above (on top of) the image which I'd do with zorder. How can I do it here?

from urllib.request import urlretrieve
urlretrieve("https://raw.githubusercontent.com/mwshinn/CanD/master/cand-logo.png", "_logo.png")

from cand import Canvas, Point, Vector

c = Canvas(20, 8, "cm")
c.add_text("Left image", Point(0.1, .8), weight="bold", size=13)
c.add_image("_logo.png", Point(1, 3, "cm"), ha="left", va="bottom", width=Vector(4, 0, "cm"))
c.add_image("_logo.png", Point(9, 4, "cm"), ha="center", va="center", height=Vector(0, 6, "cm"), unitname="middleimg")
c.add_rect(Point(-.05, -.05, "middleimg"), Point(1.05, 1.10, "middleimg"), fill=None, linewidth=3)
c.add_text("Middle image", Point(.5, 1.05, "middleimg"), weight="bold", size=12)

c.show()

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions