The answer by RZin sort-of works but, it doesn't actually align the text-- it just moves the box containing the text.
One can align the label text this way:
Label("LABEL", layout=Layout(display="flex", justify_content="flex-start")
Use "flex-start"
for left-align, "center"
for center-align, and "flex-end"
for right-align. There is also "space-between"
and "space-around"
.
Full example that can be copy and pasted into a notebook:
from ipywidgets import Label, Layout, HBox
from IPython.display import display
x = Label("Align Left", layout=Layout(display="flex", justify_content="flex-start", width="30%", border="solid"))
y = Label("Align Center", layout=Layout(display="flex", justify_content="center", width="30%", border="solid"))
z = Label("Align Right", layout=Layout(display="flex", justify_content="flex-end", width="30%", border="solid"))
display(HBox([x,y,z]))
