Exemple #1
0
    def staticDrill(self,appname):
        from guizero import Box
        appname = appname
        # second_message.value = "Static Passing Selected"
        self.drillType = "Static"

        self.window1 = Window(app, bg="#424242",height=280, width=480, layout="grid")
        # logo = Picture(self.window1, image="include/logo.gif", align="left", grid=[0, 0])
        # logo.resize(40, 40)

        Heading = Text(self.window1, "Basic Tracking", size=18, font="Calibri Bold", color="white",grid=[1,0,3,1])

        Slide1 = Text(self.window1, "Ball Speed:", size=14, font="Calibri Bold", color="white",
                      grid=[1, 1])  # , 2, 1])
        speed = Slider(self.window1, command=self.ball_speed_slider, start=1, end=5, grid=[1, 2])
        speed.width = 150
        speed.text_color = "black"
        speed.bg = "white"
        speed.text_size=14

        Slide2 = Text(self.window1, "Pass Difficulty:", size=14, font="Calibri Bold", color="white",
                      grid=[3, 1])
        difficulty = Slider(self.window1, command=self.difficulty_slider, start=1, end=5, grid=[3, 2])
        difficulty.width = 150
        difficulty.text_color = "black"
        difficulty.bg = "white"
        difficulty.text_size=14

        start = PushButton(self.window1, command=self.start_command,
                           args=[self.ballSpeed, self.difficulty, self.drillType, appname],
                           image="include/images/startbut.png", grid=[1, 5])
        start.bg = "#37f100"
        start.text_color = "white"

        stop = PushButton(self.window1, command=self.pause_command, args=[self.window1],
                          image="include/images/pausebut.png", grid=[3, 5])
        stop.bg = "#ffb000"
        stop.text_color = "white"

        exit_win = PushButton(self.window1, command=self.exit_command, args=[appname, self.window1],
                              image="include/images/stopbut.png", grid=[1, 6])
        exit_win.bg = "#e9002a"
        exit_win.text_color = "white"

        camera = PushButton(self.window1, command=self.show_cam, args=[], image="include/images/camerabut.png",
                            grid=[3, 6])
        camera.bg = "#002ff5"
        camera.text_color = "white"

        Center = Box(self.window1, width=50, height=165, grid=[2, 1, 1, 7])
        Left = Box(self.window1, width=60, height=200, grid=[0, 0, 1, 7])
        Right = Box(self.window1, width=20, height=200, grid=[4, 0, 1, 7])

        VC = PushButton(Center, command=self.enable_voice, args=[],
                          image="include/images/micbut.png", align="bottom")
Exemple #2
0
    def manualDrill(self,appname):
        # if self.player != "None":
        from guizero import Box
        appname = appname
        # second_message.value = "Entering Manual Mode"
        self.drillType = "Manual"

        self.window3 = Window(app, bg="#424242",height=280, width=480, layout="grid")
        # logo = Picture(self.window3, image="include/logo.gif", align="left", grid=[0, 0])
        # logo.resize(75, 75)
        Heading = Text(self.window3, "Voice Activated Launch", size=18, font="Calibri Bold", color="white",grid=[1,0,3,1])

        Slide1 = Text(self.window3, "Ball Speed:", size=14, font="Calibri Bold", color="white",
                      grid=[1, 1])  # , 2, 1])
        speed = Slider(self.window3, command=self.ball_speed_slider, start=1, end=5, grid=[1, 2])
        speed.width = 150
        speed.text_color = "black"
        speed.bg = "white"
        speed.text_size=14

        Slide2 = Text(self.window3, "Pass Difficulty:", size=14, font="Calibri Bold", color="white",
                      grid=[3, 1])
        difficulty = Slider(self.window3, command=self.difficulty_slider, start=1, end=5, grid=[3, 2])  # , 2, 1])
        difficulty.width = 150
        difficulty.text_color = "black"
        difficulty.bg = "white"
        difficulty.text_size=14

        start = PushButton(self.window3, command=self.start_command,
                           args=[self.ballSpeed, self.difficulty, self.drillType, appname],
                           image="include/images/startbut.png", grid=[1, 5])
        start.bg = "#37f100"
        start.text_color = "white"

        stop = PushButton(self.window3, command=self.pause_command, args=[self.window3],
                          image="include/images/pausebut.png", grid=[3, 5])
        stop.bg = "#ffb000"
        stop.text_color = "white"

        exit_win = PushButton(self.window3, command=self.exit_command, args=[appname, self.window3],
                              image="include/images/stopbut.png", grid=[1, 6])
        exit_win.bg = "#e9002a"
        exit_win.text_color = "white"

        camera = PushButton(self.window3, command=self.show_cam, args=[], image="include/images/camerabut.png",
                            grid=[3, 6])
        camera.bg = "#002ff5"
        camera.text_color = "white"

        Center = Box(self.window3, width=50, height=200, grid=[2, 1, 1, 7])
        Left = Box(self.window3, width=60, height=200, grid=[0, 0, 1, 7])
        Right = Box(self.window3, width=20, height=200, grid=[4, 0, 1, 7])
Exemple #3
0
    def user_input(self, appname):
        from guizero import Box
        appname = appname
        # second_message.value = "User Input Selected"

        self.window4 = Window(app, bg="#424242", height=280, width=480,layout="grid")

        Text(self.window4, "User Input Mode", size=18, font="Calibri Bold", color="white",grid=[1,0])

        Text(self.window4, "Please select a distance:", size=14, font="Calibri Bold", color="white",grid=[1,1])
        distance = Slider(self.window4, command=self.distance_slider, start=5, end=25,grid=[1,2])
        distance.text_size=14
        Box(self.window4,width=100,height=10,grid=[1,3])
        distance.bg="white"
        self.textbox = TextBox(self.window4,grid=[0,4,3,1])
        self.textbox.width = 40
        self.textbox.bg = "white"
        self.textbox.text_size=14
        Box(self.window4,width=100,height=10,grid=[1,5])

        send = PushButton(self.window4, command=self.send_data, args=[], image="include/images/startbut.png",grid=[1,6])
        # send.width = 30
        send.bg="#37f100"

        left = PushButton(self.window4,command=self.left_curve,args=[],text="Left",grid=[0,6])
        right = PushButton(self.window4,command=self.right_curve,args=[],text="Right",grid=[2,6])


        exit = PushButton(self.window4, command=self.close_test, args=[self.window4], image="include/images/stopbut.png",grid=[1,7])
        exit.bg = "#e9002a"
import pyfirmata
from guizero import App, Slider

board = pyfirmata.Arduino('/dev/ttyACM0')
pin = board.get_pin('d:10:p')


def slider_changed(percent):
    pin.write(int(percent) / 100.0)


app = App(title='PWM', width=500, height=150)
slider = Slider(app, command=slider_changed, width='fill', height=50)
slider.text_size = 30
app.display()
Exemple #5
0
          width=480,
          height=200)
title = Text(app, text="Smart Boiler Controller", size=20, grid=[0, 0, 2, 1])
title_message = Text(
    app,
    text="The Boiler is Currently " + actions.get_on_or_off(),
    size=15,
    grid=[0, 1, 2, 1],
)

controls = Box(app, grid=[0, 2], width=240, height=210)
controls.bg = "beige"
controls_title = Text(controls, text="Controls", size=18)
temp_title = Text(controls, text="Temperature", size=12)
temp_slider = Slider(controls)
temp_slider.text_size = 7
simple_title = Text(controls, text="Simple Controls for Boiler", size=12)
simple_radio = ButtonGroup(controls,
                           options=["on", "off"],
                           horizontal=True,
                           selected=actions.get_on_or_off())
vacation = CheckBox(controls, text="Vacation Settings")
always_on = CheckBox(controls, text="Always On")
update = PushButton(
    controls,
    text="Update Settings",
    padx=5,
    pady=5,
    command=actions.change_state,
    args=[temp_slider, simple_radio, vacation, always_on],
)
#gpiozero
play_btn.when_pressed = play_track
stop_btn.when_pressed = stop_track
pause_btn.when_pressed = pause_track
next_btn.when_pressed = next_track
previous_btn.when_pressed = previous_track
shuffle_btn.when_pressed = shuffle_tracks

#pot monitoring
volume_monitor = Thread(target=monitor_volume_pot)
volume_monitor.start()
position_monitor = Thread(target=monitor_position_pot)
position_monitor.start()

#SenseHat show track
show_track = Thread(target=show_track_name)
show_track.start()

##Set the volume to 1/2 and Load a track and pause
volume.value = "50"
progress.text_size = 0

#Load up a track
play_track()

#update the text for which track is playing each second
playing.repeat(3000, check_progress)

#run the app
app.display()