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

    wa = Combo(a, grid=[1,2], align="top")
    grid_layout_test(wa, 1, 2, 1, 1, "top")
    
    a.destroy()
github lawsie / guizero / tests / test_combo.py View on Github external
def test_cascaded_properties():
    a = App()
    c = Combo(a, ["foo", "bar"])
    cascaded_properties_test(a, c, True)
    a.destroy()
github lawsie / guizero / tests / test_combo.py View on Github external
def test_enable():
    a = App()
    c = Combo(a, ["foo", "bar"])
    enable_test(c)
    a.destroy()
github lawsie / guizero / tests / test_combo.py View on Github external
def test_color():
    a = App()
    c = Combo(a, ["foo", "bar"])
    color_test(c)
    a.destroy()
github lawsie / guizero / tests / test_combo.py View on Github external
    inherited_properties_test(a, lambda: Combo(a, ["foo", "bar"]), True)
    a.destroy()
github lawsie / guizero / tests / test_combo.py View on Github external
def test_clear():
    a = App()
    c = Combo(a, ["foo", "bar"])

    c.clear()
    assert len(c.options) == 0
    assert c.value == ""

    a.destroy()
github lawsie / guizero / tests / test_combo.py View on Github external
def test_command():
    a = App()

    callback_event = Event()
    def callback():
        callback_event.set()

    c = Combo(a, ["foo", "bar"], command = callback)
    assert not callback_event.is_set()
    # you cant invoke a tk optionmenu - this is better than no tests!
    c._command_callback(c.value)
    assert callback_event.is_set()

    a.destroy()
github lawsie / guizero / tests / test_combo.py View on Github external
def test_no_options():
    a = App()
    c = Combo(a)

    assert c.value == ""
    assert len(c.options) == 0

    c.append("foo")
    assert c.value == "foo"

    a.destroy()
github lawsie / guizero / examples / combo.py View on Github external
from guizero import App, Combo

def selected(value):
    print(value)

app = App()
combo = Combo(app, ["Nothing", "Something", "Everything"], command = selected, selected="Something")
combo.remove("Something")
combo2 = Combo(app)
combo2.append("hi")
combo2.append("bye")
app.display()
github lawsie / guizero / examples / using_turtle2.py View on Github external
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()