Ejemplo n.º 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")
Ejemplo n.º 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])
Ejemplo n.º 3
0
def drill_4_selection():
    second_message.value = "Predictive Passing Selected"

    window4 = Window(app, bg="darkgreen")

    welcome_message4 = Text(window4,
                            "Predictive Passing Parameters",
                            size=25,
                            font="Times New Roman",
                            color="black")

    start_4 = PushButton(window4, command=powerON, text="Start")
    pause_4 = PushButton(window4, command=powerON, text="Pause")
    start_4.width = 30
    start_4.bg = "gray"
    pause_4.width = 30
    pause_4.bg = "gray"

    #second_message4 = Text(window4, "How many targets would you like to use?", size=15, font="Times New Roman", color="black")
    #targets = Slider(window4, command=print("Okay"), start=1, end=4)
    third_message4 = Text(window4,
                          "Please select a passing speed:",
                          size=15,
                          font="Times New Roman",
                          color="black")
    ball_speed4 = Slider(window4, command=print("Okay"), start=1, end=10)
    ball_speed4.width = 300
Ejemplo n.º 4
0
def drill_1_selection():
    second_message.value = "Target Drill Selected"

    window1 = Window(app, bg="darkgreen")

    welcome_message1 = Text(window1,
                            "Target Drill Parameters",
                            size=25,
                            font="Times New Roman",
                            color="black")

    start_1 = PushButton(window1, command=drill_1_selection, text="Start")
    pause_1 = PushButton(window1, command=drill_2_selection, text="Pause")
    start_1.width = 30
    start_1.bg = "gray"
    pause_1.width = 30
    pause_1.bg = "gray"

    second_message1 = Text(window1,
                           "How many targets would you like to use?",
                           size=15,
                           font="Times New Roman",
                           color="black")
    targets = Slider(window1, command=print("Okay"), start=1, end=4)
    third_message1 = Text(window1,
                          "Please select a passing speed:",
                          size=15,
                          font="Times New Roman",
                          color="black")
    ball_speed = Slider(window1, command=print("Okay"), start=1, end=10)
    ball_speed.width = 300
Ejemplo n.º 5
0
    def predictiveDrill():
        second_message.value = "Entering Predictive Passing Mode"
        STARS_aPP.drillType = "dynamic"
        window2 = Window(app, bg="darkgreen")

        welcome_message2 = Text(window2, "Predictive Passing Controls", size=25, font="Times New Roman", color="black")

        third_message2 = Text(window2, "Please select a ball speed:", size=15, font="Times New Roman", color="black")
        speed = Slider(window2, command=STARS_aPP.ball_speed_slider, start=1, end=5)
        speed.width = 300
        
        final_message1 = Text(window2, "Please select a difficulty:", size=15, font="Times New Roman", color="black")
        difficulty = Slider(window2, command=STARS_aPP.difficulty_slider, start=1, end=5)
        difficulty.width = 300
        
        args = 1
        
        start_2 = PushButton(window2, command=STARS_aPP.start_command, args = [STARS_aPP.ballSpeed , STARS_aPP.difficulty, STARS_aPP.drillType], text="Begin")
        stop_2 = PushButton(window2, command=STARS_aPP.stop_command, text="stop")
        start_2.width = 30
        start_2.bg = "gray"
        stop_2.width = 30
        stop_2.bg = "gray"
Ejemplo n.º 6
0
    def staticDrill():
        second_message.value = "Static Passing Selected"
        STARS_aPP.drillType = "static"
        
        window1 = Window(app, bg="darkgreen")

        welcome_message2 = Text(window1, "Static Passing Parameters", size=25, font="Times New Roman", color="black")

        third_message1 = Text(window1, "Please select a passing speed:", size=15, font="Times New Roman", color="black")
        speed = Slider(window1, command=STARS_aPP.ball_speed_slider, start=1, end=5)
        speed.width = 300
        
       
        final_message1 = Text(window1, "Please select a difficulty:", size=15, font="Times New Roman", color="black")
        difficulty = Slider(window1, command=STARS_aPP.difficulty_slider, start=1, end=5)
        difficulty.width = 300
                
        start_1 = PushButton(window1, command=STARS_aPP.start_command, args = [STARS_aPP.ballSpeed , STARS_aPP.difficulty, STARS_aPP.drillType], text="Begin")
        stop_1 = PushButton(window1, command=STARS_aPP.stop_command, text="stop")
        start_1.width = 30
        start_1.bg = "gray"
        stop_1.width = 30
        stop_1.bg = "gray"
Ejemplo n.º 7
0
    def manualDrill():
        second_message.value = "Entering Manual Mode"
        STARS_aPP.drillType = "manual"

        window3 = Window(app, bg="darkgreen")

        welcome_message3 = Text(window3, "Manual Mode Controls", size=25, font="Times New Roman", color="black")

        third_message3 = Text(window3, "Please select a ball speed:", size=15, font="Times New Roman", color="black")
        speed = Slider(window3, command=STARS_aPP.ball_speed_slider, start=1, end=5)
        speed.width = 300
                
        start_3 = PushButton(window3, command=STARS_aPP.start_command, args = [STARS_aPP.ballSpeed , STARS_aPP.difficulty, STARS_aPP.drillType], text="Begin")
        stop_3 = PushButton(window3, command=STARS_aPP.stop_command, text="stop")
        start_3.width = 30
        start_3.bg = "gray"
        stop_3.width = 30
        stop_3.bg = "gray"
Ejemplo n.º 8
0
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")
text.width = 30
text.height = 2

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

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

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

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

combo = Combo(app, ["martin", "laura", "rik"])
combo.width = 50
combo.height = 2

check = CheckBox(app, "tick me")
check.width = 17
check.height = 2
Ejemplo n.º 9
0
    global b
    global g
    #global brightness
    # print('colour is ' + str(colour.value))
    #r=r*int(brightness)
    #g=g*int(brightness)
    #b=b*int(brightness)
    set_motes()


app = App(title="Ozzy's TimeLapse Booth", height=500, width=700, layout="grid")

messager = Text(app, text="Brightness =", grid=[0, 1])

slider = Slider(app, grid=[1, 2], start="1", end="90", command=space)
slider.width = 150
slider.text_color = "red"
choice = ButtonGroup(app,
                     options=[["seconds", 1], ["minutes", 60], ["hours",
                                                                3600]],
                     selected=1,
                     grid=[0, 2])

brightnessslider = Slider(app, grid=[1, 1], end="255", command=bright)
brightnessslider.width = 150

button = PushButton(app, command=thread_starting, text="Start", grid=[1, 3])
button.bg = 'green'

endbutton = PushButton(app, command=finishtimelapse, text="End", grid=[3, 3])
endbutton.bg = 'red'
Ejemplo n.º 10
0
from guizero import App, Slider, Picture


def resize():
    picture.width = width.value
    picture.height = 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()
Ejemplo n.º 11
0
btn2 = PushButton(myApp, text="Button_2", command=btn2Push, grid=[1, 3])
btn3 = PushButton(myApp, text="Button_3", command=btn3Push, grid=[1, 4])
btn4 = PushButton(myApp, text="Button_4", command=btn4Push, grid=[1, 5])

Text(myApp, text="Light Sensor", size=12, grid=[5, 0])
Text(myApp, text="light", size=12, grid=[5, 1])
btnLight = PushButton(myApp,
                      image=here + "/sun.png",
                      command=lightSense,
                      grid=[5, 2])

Text(myApp, text="Temperature Sensor", size=12, grid=[6, 0])
Text(myApp, text="temp", size=12, grid=[6, 1])
tempSlide = Slider(myApp,
                   start=150,
                   end=-50,
                   horizontal=False,
                   grid=[6, 2, 1, 4])
tempSlide.width = 50
tempSlide.height = 150

Text(myApp, text="Speaker", align="bottom", size=12, grid=[5, 4])
Text(myApp, text="buzz", align="bottom", size=12, grid=[5, 5])
buzzerPIC = Picture(myApp, image=here + "/speaker.png", grid=[5, 6])

Thread(target=myApp.repeat(
    500, readServerValues)).start()  # originally 500 miliseconds
Thread(target=myApp.repeat(500, sendServerValues)).start()

myApp.display()
Ejemplo n.º 12
0
    def __init__(self, app):
        Window.__init__(self, app, title="Scanner", layout="grid")
        self.tk.attributes("-fullscreen", True)
        self.hide()

        # Components
        Text(self, text="Scanner", grid=[0, 0, 3, 1])

        Text(self, text="Empty", grid=[0, 1])
        p1 = Picture(self, image="data/empty.jpg", grid=[0, 2])
        p1.height = 194
        p1.width = 259

        def update_empty():
            database.save_empty()
            p1.value = "data/empty.jpg"

        PushButton(self,
                   command=update_empty,
                   text="Retake Empty",
                   grid=[0, 7])

        Text(self, text="Scan", grid=[1, 1, 2, 1])
        p2 = Picture(self, image="data/testpic.jpg", grid=[1, 2])
        p2.height = 194
        p2.width = 259
        p3 = Picture(self, image="data/testscan.jpg", grid=[2, 2])
        p3.height = 135
        p3.width = 184
        m1 = Text(self, text="Card:", grid=[1, 6])

        def update_scan():
            global last_scan
            out = scanner.scan_card(img=last_scan)
            last_scan = out[0]
            if out[1] is not None:
                if len(out[1]) > 0:
                    cv2.drawContours(last_scan, out[1], -1, (0, 255, 0), 2)
            if out[2] is not None:
                cv2.drawContours(last_scan, [out[2]], -1, (255, 0, 0), 2)
            cv2.imwrite("data/testpic.jpg", last_scan)
            p2.value = "data/testpic.jpg"
            if out[3] is not None:
                cv2.imwrite("data/testscan.jpg", out[3])
                p3.value = "data/testscan.jpg"
                card = database.get_card(out[3])
                if card is None:
                    m1.value = "Card: Not Found"
                else:
                    m1.value = "Card: " + card.name

        def update_lower():
            scanner.lower = s1.value
            update_scan()

        s1 = Slider(self, command=update_lower, start=0, end=255, grid=[1, 3])
        s1.value = scanner.lower
        s1.width = 259

        def update_upper():
            scanner.upper = s2.value
            update_scan()

        s2 = Slider(self, command=update_upper, start=0, end=255, grid=[2, 3])
        s2.value = scanner.upper
        s2.width = 259

        def update_width_min():
            scanner.width_min = s3.value
            update_scan()

        s3 = Slider(self,
                    command=update_width_min,
                    start=0,
                    end=1500,
                    grid=[1, 4])
        s3.value = scanner.width_min
        s3.width = 259

        def update_width_max():
            scanner.width_max = s4.value
            update_scan()

        s4 = Slider(self,
                    command=update_width_max,
                    start=0,
                    end=1500,
                    grid=[2, 4])
        s4.value = scanner.width_max
        s4.width = 259

        def update_height_min():
            scanner.height_min = s5.value
            update_scan()

        s5 = Slider(self,
                    command=update_height_min,
                    start=0,
                    end=1500,
                    grid=[1, 5])
        s5.value = scanner.height_min
        s5.width = 259

        def test_scanner():
            out = scanner.scan_card()
            global last_scan
            last_scan = out[0]
            if out[1] is not None:
                if len(out[1]) > 0:
                    cv2.drawContours(last_scan, out[1], -1, (0, 255, 0), 2)
            if out[2] is not None:
                cv2.drawContours(last_scan, [out[2]], -1, (255, 0, 0), 2)
            cv2.imwrite("data/testpic.jpg", last_scan)
            p2.value = "data/testpic.jpg"
            if out[3] is not None:
                cv2.imwrite("data/testscan.jpg", out[3])
                p3.value = "data/testscan.jpg"
                card = database.get_card(out[3])
                if card is None:
                    m1.value = "Card: Not Found"
                else:
                    m1.value = "Card: " + card.name

        PushButton(self, command=test_scanner, text="Scan", grid=[1, 7])

        def close_scanner():
            self.hide()

        PushButton(self, command=close_scanner, text="Exit", grid=[0, 8, 2, 1])