How to use the guizero.ButtonGroup 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_buttongroup.py View on Github external
def test_repeat_schedule():
    a = App()
    b = ButtonGroup(a, ["foo", "bar"])
    schedule_repeat_test(a, b)
    a.destroy()
github lawsie / guizero / tests / test_buttongroup.py View on Github external
def test_grid_layout():
    a = App(layout="grid")
    
    w = ButtonGroup(a, grid=[1,2])
    grid_layout_test(w, 1, 2, 1, 1, None)
    
    ws = ButtonGroup(a, grid=[1,2,3,4])
    grid_layout_test(ws, 1, 2, 3, 4, None)

    wa = ButtonGroup(a, grid=[1,2], align="top")
    grid_layout_test(wa, 1, 2, 1, 1, "top")
    
    a.destroy()
github lawsie / guizero / tests / test_buttongroup.py View on Github external
def test_events():
    a = App()
    b = ButtonGroup(a, ["foo", "bar"])
    events_test(b)
    a.destroy()
github lawsie / guizero / tests / test_buttongroup.py View on Github external
def test_after_schedule():
    a = App()
    b = ButtonGroup(a, ["foo", "bar"])
    schedule_after_test(a, b)
    a.destroy()
github lawsie / guizero / tests / test_buttongroup.py View on Github external
def test_cascaded_properties():
    a = App()
    b = ButtonGroup(a, ["foo", "bar"])
    cascaded_properties_test(a, b, True)
    a.destroy()
github lawsie / guizero / tests / test_buttongroup.py View on Github external
def test_text():
    a = App()
    b = ButtonGroup(a, ["foo", "bar"])
    text_test(b)
    a.destroy()
github lawsie / guizero / tests / test_buttongroup.py View on Github external
def test_update_command():
    a = App()

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

    b = ButtonGroup(a, ["foo", "bar"])

    b._rbuttons[1].tk.invoke()
    assert not callback_event.is_set()

    b.update_command(callback)
    b._rbuttons[1].tk.invoke()
    assert callback_event.is_set()
    callback_event.clear()

    b.update_command(None)
    b._rbuttons[1].tk.invoke()
    assert not callback_event.is_set()

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

    callback_event = Event()
    def callback(value):
        assert value == "foo"
        assert b.value == "bar"
        assert b.value_text == "bar"
        callback_event.set()

    b = ButtonGroup(a, ["foo", "bar"], command = callback, args = ["foo"])

    b._rbuttons[1].tk.invoke()
    assert callback_event.is_set()

    a.destroy()
github lawsie / guizero / tests / test_buttongroup.py View on Github external
def test_alt_values():
    a = App(layout = "grid")
    b = ButtonGroup(
        a,
        ["foo", "bar"],
        "bar",
        grid = [0,1],
        align = "top",
        width=11,
        height=10)

    assert b.value == "bar"
    assert b.value_text == "bar"
    assert b.grid[0] == 0
    assert b.grid[1] == 1
    assert b.align == "top"
    assert b.width == 11
    assert b.height == 10
    a.destroy()
github lawsie / guizero / examples / demo_converted_from_tk_v1.py View on Github external
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()