How to use the guizero.Slider 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_slider.py View on Github external
def test_cascaded_properties():
    a = App()
    s = Slider(a)
    cascaded_properties_test(a, s, True)
    a.destroy()
github lawsie / guizero / tests / test_slider.py View on Github external
def test_destroy():
    a = App()
    s = Slider(a)
    destroy_test(s)
    a.destroy()
github lawsie / guizero / tests / test_slider.py View on Github external
def test_events():
    a = App()
    s = Slider(a)
    events_test(s)
    a.destroy()
github lawsie / guizero / tests / test_slider.py View on Github external
    inherited_properties_test(a, lambda: Slider(a), True)
    a.destroy()
github lawsie / guizero / tests / test_slider.py View on Github external
def test_default_values():
    a = App()
    s = Slider(a)
    assert s.tk.cget("from") == 0
    assert s.tk.cget("to") == 100
    assert s.tk.cget("orient") == "horizontal"
    assert s.master == a
    assert s.grid == None
    assert s.align == None
    a.destroy()
github lawsie / guizero / tests / test_slider.py View on Github external
def test_update_command():
    a = App()

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

    s = Slider(a)

    s._command_callback(s.value)
    assert not callback_event.is_set()

    s.update_command(callback)
    s._command_callback(s.value)
    assert callback_event.is_set()
    callback_event.clear()

    s.update_command(None)
    s._command_callback(s.value)
    assert not callback_event.is_set()

    a.destroy()
github lawsie / guizero / examples / colors_and_text.py View on Github external
from guizero import App, ButtonGroup, CheckBox, Combo, PushButton, Slider, Text, TextBox

a = App(title="colors")
text = Text(a, text="colors")
check = CheckBox(a, "check me")
combo = Combo(a, ["red", "blue"])
button = PushButton(a)
slider = Slider(a)
textbox = TextBox(a, text="or colours")
bgroup = ButtonGroup(a, ["cheese", "ham", "salad"], 1)

a.bg = (255,255,0)
text.text_color = "red"
text.text_size = 30
text.font = "verdana"
text.bg = "green"
check.bg = "#d41789"
combo.bg = "blue"
combo.text_color = "green"
combo.text_size = 24
button.bg = "black"
button.text_color = (255,0,255)
button.font = "arial"
button.text_size = 18
github lawsie / guizero / examples / changing_sizes.py View on Github external
from guizero import App, TextBox, Text, Slider, PushButton, Picture, Combo, CheckBox, ButtonGroup, Box

app = App(title="different sizes", width = 700, height=700)

text = Text(app, "lets change some sizes", width=20, height=2)

text_box = TextBox(app, "some text", width=50)

slider = Slider(app, width=300, height=30)

button = PushButton(app, width=20, height=2)

pic = Picture(app, image="guizero.gif", width=400, height=50)

combo = Combo(app, ["martin", "laura", "rik"], width="fill", height="fill")

check = CheckBox(app, "tick me", width=20, height=3)
check.bg = "blue"

button_group = ButtonGroup(app, ["cheese", "onion", "crisps"], 1, width=20, height=9)
button_group.bg = "darkgrey"

box = Box(app, width=100, height=100)
box.border = True
github lawsie / guizero / examples / paint.py View on Github external
tool_box = Box(a, height="fill", border=True, align="left")
paint_box = Box(a, width="fill", height="fill", border=True, align="right")

tool = Combo(tool_box, options=["line", "rectangle", "oval"], selected="line", align="top", width="fill", command=select_tool)

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 lawsie / guizero / examples / scale_picture.py View on Github external
from guizero import App, Slider, Picture

def resize():
    picture.resize(width.value, height.value)

app = App(layout="grid", width=550, height=200)

picture = Picture(app, image="guizero.gif", grid=[0,1])

width = Slider(app, command=resize, grid=[0,0], start=1, end=picture.width)
width.width = picture.width
width.value = picture.width

height = Slider(app, command=resize, horizontal=False, grid=[1,1], start=1, end=picture.height)
height.height = picture.height
height.value = picture.height

app.display()