How to use the guizero.Waffle 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_waffle.py View on Github external
def test_enable():
    a = App()
    w = Waffle(a)
    enable_test(w)
    a.destroy()
github lawsie / guizero / tests / test_waffle.py View on Github external
def test_repeat_schedule():
    a = App()
    w = Waffle(a)
    schedule_repeat_test(a, w)
    a.destroy()
github lawsie / guizero / tests / test_waffle.py View on Github external
def test_color():
    a = App()
    w = Waffle(a)
    color_test(w)
    a.destroy()
github lawsie / guizero / tests / test_waffle.py View on Github external
def test_grid_layout():
    a = App(layout="grid")
    
    w = Waffle(a, grid=[1,2])
    grid_layout_test(w, 1, 2, 1, 1, None)
    
    ws = Waffle(a, grid=[1,2,3,4])
    grid_layout_test(ws, 1, 2, 3, 4, None)

    wa = Waffle(a, grid=[1,2], align="top")
    grid_layout_test(wa, 1, 2, 1, 1, "top")
    
    a.destroy()
github lawsie / guizero / tests / test_waffle.py View on Github external
def test_default_values():
    a = App()
    w = Waffle(a)
    assert w.master == a
    assert w.grid == None
    assert w.align == None
    assert w.width == 3
    assert w.height == 3
    assert w.pixel_size == 20
    assert w.pad == 5
    assert w.color == "white"
    assert w.dotty == False
    a.destroy()
github lawsie / guizero / tests / test_waffle.py View on Github external
def test_reset():
    from itertools import chain

    a = App()
    w = Waffle(a)

    w.set_pixel(0, 1, "red")
    w.reset()

    pixels = chain.from_iterable(zip(*w.get_all()))

    count = 0
    for pixel in pixels:
        assert pixel == w.color
        count += 1

    assert count == w.width * w.height

    a.destroy()
github lawsie / guizero / tests / test_waffle.py View on Github external
def test_set_get_pixel():
    a = App()
    w = Waffle(a)

    w.set_pixel(0,0, "red")
    assert w.get_pixel(0,0) == "red"

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

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

    w = Waffle(a, command = callback)
    assert not callback_event.is_set()

    mock_waffle_clicked(w)

    assert callback_event.is_set()

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

    callback_event = Event()
    def callback(x, y):
        assert x == 0
        assert y == 1
        callback_event.set()

    w = Waffle(a, command = callback)
    assert not callback_event.is_set()

    mock_waffle_clicked(w)

    assert callback_event.is_set()

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

    callback_event = Event()
    def callback(x, y):
        assert x == 0
        assert y == 1
        callback_event.set()

    w = Waffle(a)

    w.update_command(callback)

    mock_waffle_clicked(w)
    assert callback_event.is_set()

    a.destroy()