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_enable():
a = App()
c = CheckBox(a, "foo")
enable_test(c)
a.destroy()
def test_display():
a = App()
c = CheckBox(a, "foo")
display_test(c)
a.destroy()
def test_update_command():
a = App()
callback_event = Event()
def callback():
callback_event.set()
c = CheckBox(a, "foo")
c.tk.invoke()
assert not callback_event.is_set()
c.update_command(callback)
c.tk.invoke()
assert callback_event.is_set()
callback_event.clear()
c.update_command(None)
c.tk.invoke()
assert not callback_event.is_set()
a.destroy()
def test_getters_setters():
a = App()
c = CheckBox(a, "foo")
assert c.text == "foo"
c.text = "bar"
assert c.text == "bar"
assert not c.value
c.value = True
assert c.value
a.destroy()
from guizero import App, CheckBox
def checked():
print(check.value)
app = App()
check = CheckBox(app, "check this", command=checked)
app.display()
def set_framerate():
global framerate
framerate = slider_framerate.value
def sh_rotation():
sh.set_rotation(int(combo_rotation.value))
app = App(title="8x8 Grid Editor",layout="grid",height=540, width=500)
box_top = Box(app, layout="grid", grid=[0,0,5,1])
button_go_start = PushButton(box_top, command=go_start,grid=[0,0,2,1], text = "<<", image=HOME+"/RPi_8x8GridDraw/images/endl.png")
button_left = PushButton(box_top, command=left,grid=[2,0,2,1], text = "<",image=HOME+"/RPi_8x8GridDraw/images/left.png")
button_play = PushButton(box_top, command=play,grid=[4,0,2,1], text = "PLAY", image=HOME+"/RPi_8x8GridDraw/images/play.png")
button_stop = PushButton(box_top, command=stop,grid=[6,0,2,1], text = "STOP",enabled=False, image=HOME+"/RPi_8x8GridDraw/images/stop.png")
button_right = PushButton(box_top, command=right,grid=[8,0,2,1], text = ">",image=HOME+"/RPi_8x8GridDraw/images/right.png")
button_go_end = PushButton(box_top, command=go_end,grid=[10,0,2,1], text = ">>",image=HOME+"/RPi_8x8GridDraw/images/endr.png")
checkbox_repeat = CheckBox(app, text=" Repeat",grid=[6,0,1,1])
box_framerate = Box(app, layout="grid", grid=[7,0,2,1])
box_framerate.set_border(0,"#ff0000")
slider_framerate = Slider(box_framerate, command=set_framerate, grid=[0,0],start=1, end=25)
text_slider = Text(box_framerate, text="Framerate (fps)", grid = [0,1], size=10)
matrix = Waffle(app,height=8,width=8,dim=30,command=p_clicked,color="black",grid=[0,1,7,7])
palette = Waffle(app,height=10, width=1, dim =20, command = col_select,grid=[7,1,1,7])
palette.set_pixel(0, 0, "red")
palette.set_pixel(0,1, (0,255,0))
palette.set_pixel(0,2, "blue")
palette.set_pixel(0,3, "yellow")
palette.set_pixel(0,4, (100,100,100))
palette.set_pixel(0,5, "white")
palette.set_pixel(0,6, (255,0,255))
palette.set_pixel(0,7, "orange")
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
box.bg = "red"
app.display()
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"
lastNameText = TextBox(app, width=25, grid=[1,1])
countryCombo = Combo(app, options=['United Kingdom', 'United States', 'France'], selected='United Kingdom', grid=[1,2])
addressText1 = TextBox(app, width=25, grid=[1,3])
addressText2 = TextBox(app, width=25, grid=[1,4])
addressText3 = TextBox(app, width=25, grid=[1,5])
addressText4 = TextBox(app, width=25, grid=[1,6])
addressText5 = TextBox(app, width=25, grid=[1,7])
addressText6 = TextBox(app, width=25, grid=[1,8])
jobTitleLabel = Text(app, text="TBA", grid=[1,9], size=10)
salaryLabel = Text(app, text="Salary : ", grid=[2,0,2,1], align="left", size=10)
salaryScale = Slider(app, start=10000, end=100000, grid=[2,1,2,1], command=do_salaryScale, align="left")
fullTimeCheckBox = CheckBox(app, text="Full-time?", grid=[2,2,2,1], command=do_fullTimeCheckBox, align="left")
jobButtonGroup = ButtonGroup(app, options=["Programmer", "Developer", "Web Developer", "Designer"],
selected=0, grid=[2,3,2,4], command=do_jobButtonGroup, align="left")
okPushButton = PushButton(app, text="OK", command=do_okPushButton, grid=[2,9], padx=5, pady=5)
closePushButton = PushButton(app, text="Close", command=do_closePushButton, grid=[3,9], padx=5, pady=5)
app.display()
countryCombo = Combo(app, options=['United Kingdom', 'United States', 'France'], selected='United Kingdom', grid=[1,2])
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()