Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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()
def test_cascaded_properties():
a = App()
c = Combo(a, ["foo", "bar"])
cascaded_properties_test(a, c, True)
a.destroy()
def test_enable():
a = App()
c = Combo(a, ["foo", "bar"])
enable_test(c)
a.destroy()
def test_color():
a = App()
c = Combo(a, ["foo", "bar"])
color_test(c)
a.destroy()
inherited_properties_test(a, lambda: Combo(a, ["foo", "bar"]), True)
a.destroy()
def test_clear():
a = App()
c = Combo(a, ["foo", "bar"])
c.clear()
assert len(c.options) == 0
assert c.value == ""
a.destroy()
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()
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()
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()
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()