rassberry pi
Posts: 6
Joined: Mon Jun 29, 2020 1:22 am

Align Left function not working

Mon Jun 29, 2020 1:35 am

Hi all,

I am trying to get box 2, box 3, and box 4 to align to the left instead of aligning to the center. I have tried putting align="left" in Box() but it does not work. I have attached my code and an attachment of guizero running the code below.

Code: Select all

#box 2
box2 = Box(app, border=True)
text2 = Text(box2, text="Photo",size=20, font="Times new roman", color="black", width="fill", align="left")

#box 3
box3 = Box(app, border=True)
text = Text(box3, text="Number of Pictures", size=15, font="Times new roman", color="blue", align="left")
choice = ButtonGroup(box3, options=["Single Snap", "Multiple n="], selected="Single Snap", horizontal=True, align="left")
choice.text_size = 15
multiplenbox = TextBox(box3, align="right")

#box 4
box4 = Box(app, border=True)
intervalbptxt = Text(box4, text= "Interval between Pictures", size=15, font="Times new roman", align="left", color="blue")
intervalbox = TextBox(box4, align="left")
intervalbptxt.text_size = 15
text = Text(box4, text= "milliseconds", size=15, align="right")

Kind regards,
rassberry pi
Attachments
test.JPG
test.JPG (14.96 KiB) Viewed 156 times

rassberry pi
Posts: 6
Joined: Mon Jun 29, 2020 1:22 am

Re: Align Left function not working

Tue Jun 30, 2020 10:23 pm

I am going to /bump this topic. Any help is much appreciated!

rp

User avatar
MrYsLab
Posts: 431
Joined: Mon Dec 15, 2014 7:14 pm
Location: Noo Joysey, USA

Re: Align Left function not working

Wed Jul 01, 2020 3:22 pm

Does this do what you are trying to do?

Code: Select all

from guizero import App, Text, Box, TextBox, ButtonGroup
app = App(layout="grid", title="Hello world")


#box 2
box2 = Box(app, border=True, grid=[0,0], align='left')
text2 = Text(box2, text="Photo",size=20, font="Times new roman", color="black")

box3 = Box(app, border=True, grid=[0,2], align='left')
text_box3 = Text(box3, text="Number of Pictures", size=15, font="Times new roman", color="blue", align="left")
choice = ButtonGroup(box3, options=["Single Snap", "Multiple n="], selected="Single Snap", horizontal=True, align="left")
choice.text_size = 15
multiplenbox = TextBox(box3, align="right")

#box 4
box4 = Box(app, border=True, grid=[0,3], align='left')
intervalbptxt = Text(box4, text= "Interval between Pictures", size=15, font="Times new roman", align="left", color="blue")
intervalbox = TextBox(box4, align="left")
intervalbptxt.text_size = 15
text_box4= Text(box4, text= "milliseconds", size=15, align="right")
app.display()

rassberry pi
Posts: 6
Joined: Mon Jun 29, 2020 1:22 am

Re: Align Left function not working

Thu Jul 02, 2020 8:30 pm

Thank you MrYsLab for the help! The grid function definitely helped align everything to the left.

Kind regards,
rp

Return to “Python”