How to use the guizero.TextBox 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_textbox.py View on Github external
def test_grid_layout():
    a = App(layout="grid")
    
    w = TextBox(a, grid=[1,2])
    grid_layout_test(w, 1, 2, 1, 1, None)
    
    ws = TextBox(a, grid=[1,2,3,4])
    grid_layout_test(ws, 1, 2, 3, 4, None)

    wa = TextBox(a, grid=[1,2], align="top")
    grid_layout_test(wa, 1, 2, 1, 1, "top")
    
    a.destroy()
github lawsie / guizero / tests / test_textbox.py View on Github external
def test_enable():
    a = App()
    t = TextBox(a)
    enable_test(t)
    a.destroy()
github lawsie / guizero / tests / test_textbox.py View on Github external
def test_color():
    a = App()
    t = TextBox(a)
    color_test(t)
    a.destroy()
github lawsie / guizero / examples / layout_boxes.py View on Github external
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 / demo_converted_from_tk_v1.py View on Github external
])

# 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])
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)
github lawsie / guizero / examples / demo_converted_from_tk_v1.py View on Github external
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])
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")
github lawsie / guizero / examples / demo_converted_from_tk_v1.py View on Github external
# 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])
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_v1.py View on Github external
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])
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 / app_events.py View on Github external
def mouse_enters(e):
    e.widget.bg = "lightblue"

def mouse_leaves(e):
    e.widget.bg = "white"

def right_pressed():
    waffle.set_pixel(0,0,"green")

def right_released():
    waffle.set_pixel(0,0,"grey")

app = App()
text = Text(app, text="events")
slider = Slider(app)
text_box = TextBox(app)
check = CheckBox(app, "check")
waffle = Waffle(app)

# when clicked
text.when_clicked = intro

# when key pressed
text_box.when_key_pressed = key_pressed

# highlight widget when move over
check.when_mouse_enters = mouse_enters
check.when_mouse_leaves = mouse_leaves
slider.when_mouse_enters = mouse_enters
slider.when_mouse_leaves = mouse_leaves
text_box.when_mouse_enters = mouse_enters
text_box.when_mouse_leaves = mouse_leaves
github lawsie / guizero / examples / demo_converted_from_tk_v2.py View on Github external
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)

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

fullTimeCheckBox = CheckBox(app, text="Full-time?", grid=[2,2,2,1], command=do_fullTimeCheckBox, align="left")
jobButtonGroup = ButtonGroup(app, options=["Programmer", "Developer", "Web Developer", "Designer"],
                             selected=0, grid=[2,3,2,4], command=do_jobButtonGroup, align="left")

okPushButton = PushButton(app, text="OK", command=do_okPushButton, grid=[2,9], padx=5, pady=5)