How to use the guizero.Text function in guizero

To help you get started, we’ve selected a few guizero examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lawsie / guizero / tests / test_text.py View on Github external
    inherited_properties_test(a, lambda: Text(a), True)
    a.destroy()
github lawsie / guizero / tests / test_app.py View on Github external
def test_enable():
    a = App()
    t = Text(a)
    cascading_enable_test(a)
    a.destroy()
github lawsie / guizero / examples / demo_converted_from_tk_v1.py View on Github external
countryLabel = Text(app, text="Country", grid=[0,2], align="left", size=10)
addressLabel = Text(app, text="Address", grid=[0,3], align="left", size=10)

firstNameText = TextBox(app, width=25, grid=[1,0])
lastNameText = TextBox(app, width=25, grid=[1,1])
countryCombo = Combo(app, options=['United Kingdom', 'United States', 'France'], selected='United Kingdom', grid=[1,2])
box = Box(app, grid=[1,3], layout="grid")

addressText1 = TextBox(box, width=25, grid=[0,0])
addressText2 = TextBox(box, width=25, grid=[0,1])
addressText3 = TextBox(box, width=25, grid=[0,2])
addressText4 = TextBox(box, width=25, grid=[0,3])
addressText5 = TextBox(box, width=25, grid=[0,4])
addressText6 = TextBox(box, width=25, grid=[0,5])

jobTitleLabel = Text(app, text="TBA", grid=[1,4], size=10)

salaryLabel = Text(app, text="Salary : ", grid=[2,0], align="left", size=10)
salaryScale = Slider(app, start=10000, end=100000, grid=[2,1], command=do_salaryScale, align="left")

fullTimeCheckBox = CheckBox(app, text="Full-time?", grid=[2,2], command=do_fullTimeCheckBox, align="left")
jobButtonGroup = ButtonGroup(app, options=["Programmer", "Developer", "Web Developer", "Designer"],
                             selected=0, grid=[2,3], command=do_jobButtonGroup, align="left")
box1 = Box(app, grid=[2,4], layout="grid", align="left")
okPushButton = PushButton(box1, text="OK", command=do_okPushButton, grid=[0,0], padx=5, pady=5)
closePushButton = PushButton(box1, text="Close", command=do_closePushButton, grid=[2,0], padx=5, pady=5)


app.display()
github lawsie / guizero / examples / demo_converted_from_tk_v2.py View on Github external
def do_okPushButton():
    info("Information", "Thank you!")

def do_closePushButton():
    if yesno("Exit?", "Exit program?") == True:
        app.destroy()

menubar = MenuBar(app,
                  toplevel=["File"],
                  options=[
                      [ ["Exit", exit_function] ]
                  ])

# Layout the app controls
firstNameLabel = Text(app, text="First Name", grid=[0,0], align="left", size=10)
lastNameLabel = Text(app, text="Last Name", grid=[0,1], align="left", size=10)
countryLabel = Text(app, text="Country", grid=[0,2], align="left", size=10)
addressLabel = Text(app, text="Address", grid=[0,3], align="left", size=10)

firstNameText = TextBox(app, width=25, grid=[1,0])
lastNameText = TextBox(app, width=25, grid=[1,1])
countryCombo = Combo(app, options=['United Kingdom', 'United States', 'France'], selected='United Kingdom', grid=[1,2])

addressText1 = TextBox(app, width=25, grid=[1,3])
addressText2 = TextBox(app, width=25, grid=[1,4])
addressText3 = TextBox(app, width=25, grid=[1,5])
addressText4 = TextBox(app, width=25, grid=[1,6])
addressText5 = TextBox(app, width=25, grid=[1,7])
addressText6 = TextBox(app, width=25, grid=[1,8])

jobTitleLabel = Text(app, text="TBA", grid=[1,9], size=10)
github lawsie / guizero / examples / resize_waffle.py View on Github external
from guizero import App, Box, Waffle, Slider, Text

def change_dim(slider):
    print("Changing size to {}x{} ".format(g_width.value, g_height.value))
    grid.resize(g_width.value, g_height.value)

app = App("Changing size")

grid = Waffle(app)

controls = Box(app, layout = "grid")

# Width
width_text = Text(controls, text="Width", grid=[0,0])
g_width = Slider(controls, start=0, end=20, command=change_dim, grid=[1,0])
g_width.value = 4

# Height
height_text = Text(controls, text="Height", grid=[0,1])
g_height = Slider(controls, start=0, end=20, command=change_dim, grid=[1,1])
g_height.value = 4

app.display()
github lawsie / guizero / examples / using_turtle2.py View on Github external
turtle2.clear()

    for i in range(sides.value):
        turtle.forward(length.value)
        turtle.right(int(360 / sides.value))
        turtle2.forward(length.value)
        turtle2.right(int(360 / sides.value))

Text(a, text="this is a guizero turtle")

buttons_box = Box(a)

Text(buttons_box, text="no. of sides: ", align="left")
sides = Slider(buttons_box, start=3, end=10, align="left")

Text(buttons_box, text="length: ", align="left")
length = Slider(buttons_box, start=10, end=100, align="left")
length.value = 100

color = Combo(buttons_box, align="left", options=["red", "green", "blue", "yellow", "purple", "black"])

draw_button = PushButton(buttons_box, text="Draw", align="left", command=draw)

turtle = Turtle(a, width="fill", height="fill")
turtle2 = Turtle(turtle, width="fill", height="fill")

a.display()
github lawsie / guizero / examples / paint.py View on Github external
color_label = Text(tool_box, text="color", align="top", width="fill")
color_label.bg = "black"
color_label.text_color = "white"

red = Slider(tool_box, end=255, command=update_color)
red.bg = (255, 0, 0)

green = Slider(tool_box, end=255, command=update_color)
green.bg = (0, 255, 0)

blue = Slider(tool_box, end=255, command=update_color)
blue.bg = (0, 0, 255)

line_width_box = Box(tool_box, align="top")
Text(line_width_box, text="width", align="top")
line_width = Slider(line_width_box, start=1, end=10, align="top")

painting = Drawing(paint_box, width="fill", height="fill")
painting.last_event = None
painting.last_shape = None
painting.when_left_button_pressed = start_paint
painting.when_mouse_dragged = draw_paint
painting.when_left_button_released = stop_paint

PushButton(tool_box, text="Clear", command=painting.clear, align="bottom", width="fill")

a.display()
github topshed / RPi_8x8GridDraw / 8x8grid-guizero.py View on Github external
matrix = Waffle(app,height=8,width=8,dim=30,command=p_clicked,color="black",grid=[0,1,7,7])
palette = Waffle(app,height=10, width=1, dim =20, command = col_select,grid=[7,1,1,7])
palette.set_pixel(0, 0, "red")
palette.set_pixel(0,1, (0,255,0))
palette.set_pixel(0,2, "blue")
palette.set_pixel(0,3, "yellow")
palette.set_pixel(0,4, (100,100,100))
palette.set_pixel(0,5, "white")
palette.set_pixel(0,6, (255,0,255))
palette.set_pixel(0,7, "orange")
palette.set_pixel(0,8, "black")
palette.set_pixel(0,9, (66,220,240))
box = Box(app, width=30,height=30,grid=[2,10,2,1])
box.bg =col
text_current_col = Text(app, text="Selected Colour:", grid=[0,10,3,1])
text_rotation = Text(app, text="LED Rotation:", grid=[5,10,3,1])
combo_rotation = Combo(app, options=["0", "90", "180", "270"],grid=[8,10,2,1],command=sh_rotation)


button_clear = PushButton(app, command=clear_matrix,grid=[8,1], text = "Clear")
button_clear.bg = col


frame_status_text = Text(app, text="Frame " + str(current_frame_number).zfill(3) + " of " + str(len(frames)).zfill(3), grid=[0,11,3,1])
button_new_frame = PushButton(app, command=new_frame,grid=[3,11,2,1], text = "New",padx=28)
button_new_frame = PushButton(app, command=copy_frame,grid=[5,11,2,1], text = "Duplicate")
button_new_frame = PushButton(app, command=delete_frame,grid=[7,11,2,1], text = "Delete", padx=20)


prev_matrix = Waffle(app,height=8,width=8,dim=8,color="grey",grid=[0,13,3,3])
next_matrix = Waffle(app,height=8,width=8,dim=8,color="grey",grid=[7,13,3,3])
github lawsie / guizero / examples / layout_boxes.py View on Github external
from guizero import App, Box, Text, TextBox
app = App()

title_box = Box(app, width="fill", align="top", border=True)
Text(title_box, text="title")

buttons_box = Box(app, width="fill", align="bottom", border=True)
Text(buttons_box, text="buttons")

options_box = Box(app, height="fill", align="right", border=True)
Text(options_box, text="options")

content_box = Box(app, align="top", width="fill", border=True)
Text(content_box, grid=[0,0], text="content")

form_box = Box(content_box, layout="grid", width="fill", align="left", border=True)
Text(form_box, grid=[0,0], text="form")
Text(form_box, grid=[0,1], text="label")
TextBox(form_box, grid=[1,1], text="data", width="fill")

app.display()
github lawsie / guizero / examples / multi_box.py View on Github external
screen.hide()


app = App("Multi box app", layout="grid")

# Create a blank list to hold all the different screens
all_screens = []

# Create a box to contain the menu buttons
menu = Box(app, grid=[0,0], layout="grid")
menu.tk.width = 900
menu.bg = "red"

# Option 1 box
option1 = Box(app, grid=[1,1])
text1 = Text(option1, text="This is the first page of stuff")
combo = Combo(option1, options=["Beef", "Chicken", "Fish", "Vegetarian"])
all_screens.append(option1)

# Option 2 box
option2 = Box(app, grid=[1,1])
text2 = Text(option2, text="This is the second page of stuff")
slider = Slider(option2)
all_screens.append(option2)

# Add the screens to the menu box
option1_button = PushButton(menu, text="Option 1", command=switch_screen, args=[option1], grid=[0,0], align="left")
option2_button = PushButton(menu, text="Option 2", command=switch_screen, args=[option2], grid=[1,0], align="left")

# Hide all screens and then show the first one
hide_all()
all_screens[0].show()