Exemplo n.º 1
0
def Run():
    global startWindow
    global finalCheck
    global startButtons

    startWindow = Window(app, title="Starting Screen", layout="grid")
    startWindow.width = 360; startWindow.height = 630; startWindow.bg = "Lime"

    playersQuestionText = Text(startWindow, text="How Many Players?", grid=[0, 0], align="top")
    playersQuestionText.text_size = 25
    playerButtonContainer = Box(startWindow, layout="grid", grid=[0, 1], align="top", border=True)
    playerButtonContainer.set_border(10, "Lime")
    buttonOnePlayer = PushButton(playerButtonContainer, text="1 Player", grid=[1, 0], command=lambda: SetPlayerNumber(True, "1 Player"))
    buttonOnePlayer.width = 20; buttonOnePlayer.height = 10; buttonOnePlayer.bg = "White"
    buttonTwoPlayer = PushButton(playerButtonContainer, text="2 Player", grid=[2, 0], command=lambda: SetPlayerNumber(False, "2 Player"))
    buttonTwoPlayer.width = 20; buttonTwoPlayer.height = 10; buttonTwoPlayer.bg = "White"

    gameModeQuestionText = Text(startWindow, text="What Game Mode?", grid=[0, 2], align="top")
    gameModeQuestionText.text_size = 25
    gameModeButtonContainer = Box(startWindow, layout="grid", grid=[0, 3], align="top", border=True)
    gameModeButtonContainer.set_border(10, "Lime")
    buttonAddition = PushButton(gameModeButtonContainer, text="Addition", grid=[1, 0], command=lambda: SetGameMode(True, "Addition"))
    buttonAddition.width = 20; buttonAddition.height = 10; buttonAddition.bg = "White"
    buttonSubtraction = PushButton(gameModeButtonContainer, text="Subtraction", grid=[2, 0], command=lambda: SetGameMode(False, "Subtraction"))
    buttonSubtraction.width = 20; buttonSubtraction.height = 10; buttonSubtraction.bg = "White"

    finalCheck = Box(startWindow, layout="grid", grid=[0, 4], align="top", border=True)
    finalCheck.set_border(10, "Lime")
    startButton = PushButton(finalCheck, text="Start!", grid=[0, 2], align="top", command=StartGame)
    startButton.width = 20; startButton.height = 5; startButton.bg = "White"; startButton.disable()
Exemplo n.º 2
0
    def __init__(self, cam_control):
        # Configuring GUI application
        self.app = App('Pi-Snap', width=1920, height=1200)
        self.cam = Camera()

        self.cam_control = cam_control

        # Main page(frame)
        self.main = Box(self.app)
        self.main_img = Picture(self.main, image='./static/main.png')
        self.new_pic_btn = PushButton(self.main, cam_control, text='New pic')

        # Result page(frame)
        self.result = Box(self.app)
        self.title_txt = Text(self.result, text='Ta-da!', size=40, color='#1956b7')
        self.result_img = Picture(self.result)
        self.guide_txt = Text(
            self.result,
            text='If you want to receive this picture, Please enter your email :)',
            size=25
        )
        self.email_txt = TextBox(self.result, width=25)
        self.send_btn = PushButton(self.result, self.send_email, text='Send')
        self.cancel_btn = PushButton(self.result, self.go_to_main, text='Cancel')
        self.result.visible = False

        self.th = threading.Thread(target=self.read_button)
        self.th.daemon = True
Exemplo n.º 3
0
def StartOnePlayer():
    global onePlayerWindow
    global drawButtonOnePlayer
    global cardImagesOnePlayer
    global guessContainerOnePlayer
    global guessCheckButtonOnePlayer
    global guessTextBoxOnePlayer
    global correctOnePlayer
    global errorTextOnePlayer

    onePlayerWindow = Window(app, title="One Player Game", layout="grid")
    onePlayerWindow.width = 320; onePlayerWindow.height = 560; onePlayerWindow.bg = "Lime"

    drawButtonOnePlayer = PushButton(onePlayerWindow, text="Draw!", grid=[0, 0], align="top", command=ButtonSwapOnePlayer)
    drawButtonOnePlayer.width = 20; drawButtonOnePlayer.height = 5; drawButtonOnePlayer.bg = "White"
    cardImagesOnePlayer = Box(onePlayerWindow, layout="grid", grid=[0, 1], align="top", border=True)
    cardImagesOnePlayer.set_border(10, "Lime")

    guessContainerOnePlayer = Box(onePlayerWindow, layout="grid", grid=[0, 2], align="top", border=True)
    guessContainerOnePlayer.set_border(10, "Lime")
    guessTextBoxOnePlayer = TextBox(guessContainerOnePlayer, grid=[0, 0], align="top")
    guessTextBoxOnePlayer.text_size = 20; guessTextBoxOnePlayer.bg = "White"; guessTextBoxOnePlayer.disable();
    guessCheckButtonOnePlayer = PushButton(guessContainerOnePlayer, text="Check!", grid=[0, 1], align="top", command=CheckValuesOnePlayer)
    guessCheckButtonOnePlayer.width = 20; guessCheckButtonOnePlayer.height = 5; guessCheckButtonOnePlayer.bg = "White"; guessCheckButtonOnePlayer.disable();
    pointsTextOnePlayer = Text(guessContainerOnePlayer, text="Score: ", grid=[0, 2], align="top")

    correctOnePlayer = Text(onePlayerWindow, text="", grid=[0, 3])
    errorTextOnePlayer = Text(onePlayerWindow, text="Please enter a number!", grid=[0, 4])
    errorTextOnePlayer.hide()
Exemplo n.º 4
0
def main():
    global ledButton
    # App
    app = App(title="Project house", height=400, width=400)

    # Boxes
    displayBox = Box(app, border=True, height=35, width=400)
    buttonBox = Box(app, layout="grid", align="top")

    # Title
    title = Text(displayBox, text="Push a button")
    title.text_size = 20

    # Buttons
    ledButton = PushButton(buttonBox, toggle_led, text="LED ON", grid=[0, 0])
    ledButton.text_size = 25
    blinkButton = PushButton(buttonBox,
                             led_blink,
                             text="Push to party",
                             grid=[10, 0])
    blinkButton.text_size = 25
    exitButton = PushButton(app,
                            exit_app,
                            text="EXIT",
                            align="bottom",
                            width=16,
                            height=2)
    exitButton.text_size = 32

    app.display()
Exemplo n.º 5
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"
Exemplo n.º 6
0
    def __init__(self, controller):
        self.almacenes = []
        self.selected = None

        self.controller = controller
        self.app = App(title="Interfaces", layout="grid", width=600, height=200)

        # 0, 0
        self.lista = ListBox(self.app, items=[], grid=[0,0], command=self.handleListChange)
        self.lista.width = 30

        # 1, 0
        self.detalle = Box(self.app, grid=[1,0], layout="grid")
        self.nombreLabel = Text(self.detalle, size=DETALLE_LABEL_FSIZE, text="Nombre", grid=[0,0])
        self.direcionLabel = Text(self.detalle, size=DETALLE_LABEL_FSIZE, text="Dirección", grid=[0,1])
        self.provinciaLabel = Text(self.detalle, size=DETALLE_LABEL_FSIZE, text="Provincia", grid=[0,2])
        self.cpLabel = Text(self.detalle, size=DETALLE_LABEL_FSIZE, text="CP", grid=[0,3])
        self.telefonoLabel = Text(self.detalle, size=DETALLE_LABEL_FSIZE, text="Teléfono", grid=[0,4])

        self.nombre = TextBox(self.detalle, "", grid=[1,0], width=30, enabled=False)
        self.direccion = TextBox(self.detalle, "", grid=[1,1], width=30, enabled=False)
        self.provincia = TextBox(self.detalle, "", grid=[1,2], width=30, enabled=False)
        self.cp = TextBox(self.detalle, "", grid=[1,3], width=30, enabled=False)
        self.telefono = TextBox(self.detalle, "", grid=[1,4], width=30, enabled=False)

        # 0, 1
        self.toolbar = Box(self.app, grid=[0,1], layout="grid")
        self.buttonEdit = PushButton(self.toolbar, command=self.handleEdit, text="Editar", grid=[0,0])
        self.buttonAdd = PushButton(self.toolbar, command=self.handleAdd, text="Añadir", grid=[1,0])

        # 1, 1
        self.detalleToolbar = Box(self.app, grid=[1,1], layout="grid")
        self.buttonSave = PushButton(self.detalleToolbar, command=self.handleSave, text="Guardar", grid=[0,0], enabled=False)
Exemplo n.º 7
0
def build_runtime(app):
    global tfile
    global rt_getfile, rt_settings, rt_drawimage, rt_quit

    # box = for full window
    wbox = Box(app, layout="auto", width="fill", height="fill")

    heading_box = Box(wbox, layout="auto", width="fill")
    t = Text(heading_box,
             height=2,
             text="Runtime",
             font="Helvetica",
             size=16,
             align="left")

    #--------------file row
    file_box = Box(wbox, layout="auto", width="fill", height=60)
    file_val = display_file_name("File: " + str(DataDict["default_file"]))
    tfile = Text(file_box, text=file_val, height=60, align="left")

    #--------------Start spacer_box
    controls_box = Box(wbox, layout="auto", width="fill", height=5)
    pad = Text(controls_box, width="fill")

    #--------------Start buttons_box
    bbox = Box(wbox, layout="grid", width="fill", height=50)

    line = 0
    col = -1
    col += 1
    pad = Text(bbox, grid=[col, line], width=2)
    col += 1
    rt_getfile = PushButton(bbox,
                            text="Get file",
                            grid=[col, line],
                            command=load_image_fileT)
    col += 1
    pad = Text(bbox, grid=[col, line], width=2)
    col += 1
    rt_drawimage = PushButton(bbox,
                              text="Draw Image",
                              grid=[col, line],
                              command=draw_image)
    col += 1
    pad = Text(bbox, grid=[col, line], width=2)
    col += 1
    rt_settings = PushButton(bbox,
                             text="Settings",
                             grid=[col, line],
                             command=activate_settings)
    col += 1
    pad = Text(bbox, grid=[col, line], width=2)
    col += 1
    rt_quit = PushButton(bbox,
                         text="Quit",
                         grid=[col, line],
                         command=lasergui_quit)
    rt_drawimage.disable()  # enable when we load a good file.

    return wbox
Exemplo n.º 8
0
def test():
    app = App(title='Robo', height=300, width=400, layout='grid')

    box = Box(app, layout='grid', grid=[0, 0])
    PushButton(box, r.leftMotorForward, text='Left Motor Forward', grid=[0, 0])
    PushButton(box,
               r.rightMotorForward,
               text='Right Motor Forward',
               grid=[1, 0])

    box = Box(app, layout='grid', grid=[0, 1])
    PushButton(box, r.forwardLeft, text='Forward Left', grid=[0, 0])
    PushButton(box, r.forward, text='Forward', grid=[1, 0])
    PushButton(box, r.forwardRight, text='Forward Right', grid=[2, 0])
    PushButton(box, r.pivotLeft, text='Pivot Left', grid=[0, 1])
    PushButton(box, r.stop, text='Stop', grid=[1, 1])
    PushButton(box, r.pivotRight, text='Pivot Right', grid=[2, 1])
    PushButton(box, r.backwardLeft, text='Backward Left', grid=[0, 2])
    PushButton(box, r.backward, text='Backward', grid=[1, 2])
    PushButton(box, r.backwardRight, text='Backward Right', grid=[2, 2])

    box = Box(app, layout='grid', grid=[0, 2])
    PushButton(box,
               r.leftMotorBackward,
               text='Left Motor Backward',
               grid=[0, 0])
    PushButton(box,
               r.rightMotorBackward,
               text='Right Motor Backward',
               grid=[1, 0])

    app.display()
Exemplo n.º 9
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")
Exemplo n.º 10
0
    def __init__(self, input_excel_db):
        self.min_size = 32
        self.no_bits = 8
        self.value = 0
        self.bit_map = {}
        self.bit_descr = {}
        self.endianess = "big"

        self.app = App(layout="grid", height=350, width=550)
        self.top_box = Box(self.app, layout = "grid", grid = [0, 0])
        self.bottom_box = Box(self.app, layout = "grid", grid = [0, 1])
        self.right_box = Box(self.app, grid = [1, 0, 1, 2])

        self.window = Window(self.app, width=250, height=150, visible=False)
        self.description = Text(self.window)

        # Create the text field to enter data
        self.input = TextBox(self.top_box, width=25, grid=[0,0,3,1], command=self.process_input)
        self.input.bg = "white"
        self.input.text_size = 16

        # Display the hex value
        self.out_hex = Text(self.top_box, grid=[2,1], text="0x<waiting for valid input>")
        # Display the min number of bits selector
        self.in_minsize = Combo(self.top_box, grid=[0, 1], options=["32"], command=self.process_minsize, selected="32")
        # Endianess selector
        self.in_endianess = Combo(self.top_box, grid=[1, 1], options=["little", "big"], command=self.process_endianess,
                                  selected=self.endianess)

        # Display the binary value
        self.out_bin = Text(self.top_box, grid=[0, 2, 2, 1], size=17, text="0b<waiting for valid input>")
        # Display little number after the binary value
        self.out_num = Text(self.top_box, grid=[0, 3, 2, 1], size=7, text="")


        # Prepare the waffle list
        self.waffle_list = []
        self.box_list = []
        self.text_list = []

        self.append_wb(4)
        self.append_tx(self.no_bits)

        # Read the worksheets in the input dictionary and create the list
        self.in_excel = openpyxl.load_workbook(filename = input_excel_db, read_only=True)
        self.in_regs = self.in_excel.sheetnames
        self.in_regs.insert(0, "OFF")

        # Display the list of registers
        self.in_reglist = ListBox(self.right_box, items = self.in_regs, command=self.process_reglist)

        self.input.focus()
        self.app.display()
Exemplo n.º 11
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])
Exemplo n.º 12
0
def test_grid_layout():
    a = App(layout="grid")
    
    w = Box(a, grid=[1,2])
    grid_layout_test(w, 1, 2, 1, 1, None)
    
    ws = Box(a, grid=[1,2,3,4])
    grid_layout_test(ws, 1, 2, 3, 4, None)

    wa = Box(a, grid=[1,2], align="top")
    grid_layout_test(wa, 1, 2, 1, 1, "top")
    
    a.destroy()
Exemplo n.º 13
0
def spin_up_top_bottom_spacers(parent):
    global top_space_box
    top_space_box = Box(parent, width='fill', align='top')
    global top_space_text
    top_space_text = Text(top_space_box, height='fill', width='fill', text='')

    global bottom_space_box
    bottom_space_box = Box(parent, width='fill', align='bottom')
    global bottom_space_text
    bottom_space_text = Text(bottom_space_box,
                             height='fill',
                             width='fill',
                             text='')
Exemplo n.º 14
0
    def generateNewBoard(self):

        if self.emojiShowBox != None:
            self.emojiShowBox.destroy()
        if self.emojiGuessBox != None:
            self.emojiGuessBox.destroy()

        self.emojiShowBox = Box(self, layout="grid")
        self.emojiGuessBox = Box(self, layout="grid")

        emojis_path = os.listdir("images")

        show_images = []
        guess_images = []

        # Get random images for both boxes
        for i in range(0, self.config["board_size"] - 1):
            show_images.append(
                "images/" +
                emojis_path.pop(random.randint(0,
                                               len(emojis_path) - 1)))
            guess_images.append(
                "images/" +
                emojis_path.pop(random.randint(0,
                                               len(emojis_path) - 1)))

        # Get image that is equal between both boxes
        rand_index = random.randint(0, len(emojis_path) - 1)
        self.same_image = "images/" + emojis_path[rand_index]
        show_images.append(self.same_image)
        guess_images.append(self.same_image)

        random.shuffle(show_images)
        random.shuffle(guess_images)

        board_size_rows = math.floor(math.sqrt(self.config["board_size"]))

        for i in range(0, self.config["board_size"]):
            x = i // board_size_rows
            y = i % board_size_rows

            picture = Picture(self.emojiShowBox,
                              grid=[x, y],
                              image=show_images[i])

            pushButton = PushButton(self.emojiGuessBox,
                                    grid=[x, y],
                                    image=guess_images[i])
            pushButton.update_command(command=self.is_correct_guess,
                                      args=[pushButton])
Exemplo n.º 15
0
def read_working_hours_line(start_hour, stop_hour, pump_1_value, pump_2_value,
                            pump_3_value, row_number):
    working_hour = Box(working_hours,
                       align="left",
                       layout="grid",
                       grid=[0, row_number])
    Text(working_hour, text=str(row_number) + ".", grid=[0, 0])
    start_hour_input = TextBox(working_hour,
                               text=start_hour,
                               width="4",
                               grid=[1, 0],
                               enabled=False)
    Text(working_hour, text=" - ", grid=[2, 0])
    stop_hour_input = TextBox(working_hour,
                              text=stop_hour,
                              width="4",
                              grid=[3, 0],
                              enabled=False)
    pump_1 = CheckBox(working_hour, text="Dom", grid=[4, 0], enabled=False)
    pump_2 = CheckBox(working_hour, text="Haft", grid=[5, 0], enabled=False)
    pump_3 = CheckBox(working_hour, text="Firany", grid=[6, 0], enabled=False)

    if (bool(pump_1_value)):
        pump_1.value = pump_1_value

    if (bool(pump_2_value)):
        pump_2.value = pump_2_value

    if (bool(pump_3_value)):
        pump_3.value = pump_3_value

    return True
Exemplo n.º 16
0
 def dashboard(self):
     dashboard_box = Box(self.app, layout='grid')
     Picture(dashboard_box, image="sutro.png", grid=[2, 0])
     PushButton(dashboard_box,
                text='pH Level',
                command=calculate,
                args=[99],
                grid=[1, 2],
                width=10,
                height=1).text_size = 15
     PushButton(dashboard_box,
                text='ORP',
                command=calculate,
                args=[98],
                grid=[2, 2],
                width=10,
                height=1).text_size = 15
     PushButton(dashboard_box,
                text='Temperature',
                command=calculate,
                args=[100],
                grid=[3, 2],
                width=10,
                height=1).text_size = 15
     pHVal = Text(dashboard_box, text='_ _ _ _', grid=[1, 4], size=25)
     orpVal = Text(dashboard_box, text='_ _ _ _', grid=[2, 4], size=25)
     tempVal = Text(dashboard_box, text='_ _ _ _', grid=[3, 4], size=25)
Exemplo n.º 17
0
def run_Self():
    def updateCountDownText():
        print("func rGUI")
        # imgBox1.destroy()
        # imgBox1 = Picture(box1, image="qrcode.bmp")
        # imgBox1.value("qrcode.bmp")
        countDownText.after(1000, updateCountDownText)

    app = App(title="Seeed interactive camera demo on raspberry pi",
              width=1280,
              height=768,
              bg="black",
              layout="auto")
    app.tk.attributes("-fullscreen", True)
    box1 = Box(app, layout="auto", grid=[0, 0])
    rabbit1 = Text(box1, text="#", size=100, color="black")
    #
    # imgBox1 = Picture(app, image="qrcode.bmp")

    countDownText = Text(box1, text="请领取二维码小票", size=100, color="white")
    rabbit2 = Text(box1, text="#", size=70, color="black")
    warningText = Text(box1, text="或站到拍照点开始新一轮拍照", size=50, color="white")

    countDownText.after(1000, updateCountDownText)
    app.display()

    def hide_self():
        app.visible = False

    def show_self():
        app.visible = True
Exemplo n.º 18
0
def gui_main():
    """
  The main function for GUI mode. This function sets up the GUI elements
  and launches the GUI event loop.
  """
    app = App(title="Nikola", bg="black")

    text = Text(app, color="light sky blue")
    text.text_size = 36

    keybox = Box(app, layout="grid", border=3)
    keybox.text_color = "white"
    keybox.bg = "gray"
    for row in range(4):
        keys.append([])
        for col in range(4):
            key = Text(keybox,
                       grid=[col, row],
                       text=keypad.names[row][col],
                       size=24)
            keys[row].append(key)

    slider = Slider(app, height=36, width="fill", end=100)
    slider.bg = "blue"
    slider.text_color = "white"

    app.repeat(100, gui_loop, args=[text, slider])

    keypad.init()
    rotary_encoder.init()

    app.set_full_screen()
    app.display()
Exemplo n.º 19
0
def haveRegBefore():
    global app
    global subjects

    row = 0
    count = 0

    app.destroy()
    app = App("tjek ind V1")
    Text(app, "click your name")
    box = Box(app, layout="grid")

    for i in range(1, len(subjects)):
        if ((i - 1) % 5 == 0):
            row = row + 1
            count = 0
        count = count + 1

        PushButton(box,
                   takeImg,
                   args=[i],
                   text=subjects[i],
                   grid=[count - 1, row],
                   align="left")
    app.display()
Exemplo n.º 20
0
    def __init__(self):
        self.components = {
            "AND": And,
            "OR": Or,
            "XOR": Xor,
            "NOT": Not,
            "Half Adder": HalfAdder,
            "Full Adder": FullAdder,
            "8 bit Ripple Carry Adder": EightBitRippleCarryAdder,
            "8 bit Ripple Carry Adder Subtractor":
            EightBitRippleCarryAdderSubtractor,
            "ALU": ALU,
            "2 to 1 Multiplexer": TwoToOneMultiplexer,
            "4 to 1 Multiplexer": FourToOneMultiplexer,
            "2 to 4 Decoder": TwoToFourDecoder,
            "And Or Latch": AndOrLatch,
            "Gated Latch": GatedLatch,
            "RAM Cell": RAMCell,
            "Eight Bit Register": EightBitRegister,
        }

        self.app = App(title="Philbin SS Control Panel", layout="grid")
        self.box_component = Box(self.app, grid=[0, 1])

        self.combo = Combo(self.box_component,
                           options=list(self.components.keys()),
                           command=self.reload_component)

        self.setup_component()

        self.app.display()
Exemplo n.º 21
0
def spin_up_main_buttons(parent, commands):
    global buttons_box
    buttons_box = Box(parent, width='fill', height='fill', layout='auto')

    scan_in_button = PushButton(buttons_box,
                                text='SCAN IN',
                                height='fill',
                                width='fill')
    scan_in_button.font = display_config.text_font
    scan_in_button.text_color = '#00FF21'
    scan_in_button.text_size = display_config.button_text_size
    scan_in_button.update_command(commands[0])

    scan_out_button = PushButton(buttons_box,
                                 text='SCAN OUT',
                                 height='fill',
                                 width='fill')
    scan_out_button.font = display_config.text_font
    scan_out_button.text_color = '#B60000'
    scan_out_button.text_size = display_config.button_text_size
    scan_out_button.update_command(commands[1])

    look_up_button = PushButton(buttons_box,
                                text='LOOKUP',
                                height='fill',
                                width='fill')
    look_up_button.font = display_config.text_font
    look_up_button.text_color = '#FFD800'
    look_up_button.text_size = display_config.button_text_size
    look_up_button.update_command(commands[2])
def test_enable():
    a = App()
    b = Box(a)
    t = Text(b)
    cascading_enable_test(a)
    cascading_enable_test(b)
    a.destroy()
Exemplo n.º 23
0
def run_self():
    def updateCountDownText():
        countDownText.value = input_val()
        print("func tGUI")
        countDownText.after(1000, updateCountDownText)

    def input_val():
        global input_countdownText
        if input_countdownText == 0:
            input_countdownText = 5
            app.destroy()
            return -1
        input_countdownText = input_countdownText - 1
        if input_countdownText == 0:
            return "..."
        else:
            return input_countdownText

    app = App(title="Seeed interactive camera demo on raspberry pi",
              width=1280,
              height=768,
              bg="black",
              layout="auto")
    app.tk.attributes("-fullscreen", True)
    box1 = Box(app, layout="auto", grid=[0, 0])
    countDownText = Text(box1, text="5", size=400, color="white")
    warningText = Text(box1, text="拍照倒计时", size=70, color="white")
    countDownText.after(1000, updateCountDownText)
    app.display()
Exemplo n.º 24
0
def game():
    global app, questions, answers, correct_answers, qnum, questionText, btn1, btn2, btn3, btn4, nextBtn
    eh.light.on()
    questionText = Text(app, questions[qnum])
    questionText.text_size = 40
    buttons_box = Box(app, width="fill", align="top")
    btn1 = PushButton(buttons_box, text=answers[qnum][0], align="left")
    btn1.bg = "blue"
    btn1.text_color = "white"
    btn1.text_size = 40

    btn2 = PushButton(buttons_box, text=answers[qnum][1], align="left")
    btn2.bg = (209, 182, 16)
    btn2.text_color = "white"
    btn2.text_size = 40

    btn3 = PushButton(buttons_box, text=answers[qnum][2], align="left")
    btn3.bg = "red"
    btn3.text_color = "white"
    btn3.text_size = 40

    btn4 = PushButton(buttons_box, text=answers[qnum][3], align="left")
    btn4.bg = "green"
    btn4.text_color = "white"
    btn4.text_size = 40

    nextBtn = PushButton(app, command=nextQ, text="Next", align="left")
Exemplo n.º 25
0
def willYouReg():
    global app
    app.destroy()
    app = App("tjek ind V1")
    Text(app, "will you registrate?")
    box = Box(app, layout="grid")
    PushButton(box, takeImg, text="yes", grid=[0, 1])
    PushButton(box, app.destroy, text="no", grid=[0, 0])
def test_default_values():
    a = App()
    b = Box(a)
    assert b.master == a
    assert b.layout == "auto"
    assert b.grid == None
    assert b.align == None
    a.destroy()
Exemplo n.º 27
0
    def render_node(self, current_component, parent_component=None, index=0):
        if self.name_exists(current_component.element_name):
            raise ValueError('An element with the name "' +
                             current_component.element_name +
                             '" already exists!')
        parent = self.gzframe.app if parent_component is None else parent_component.element

        current_component.parent = self.gzframe.app if parent_component is None else parent_component.element
        current_component.parent_name = 'app' if parent_component is None else parent_component.element_name
        current_component.parent_chain = 'app' if parent_component is None else parent_component.parent_chain + '>' + parent_component.element_name
        current_component.index = index

        if current_component.element_type == 'component':
            current_component.element = Box(parent)
            current_component.gzframe = self.gzframe
            current_component.element.bg = current_component.bg
            if current_component.width is not None:
                current_component.element.width = current_component.width
            current_component.gz_on_init()
            for child_index, child in enumerate(current_component.children):
                self.render_node(child, current_component, index=child_index)
        if current_component.element_type == 'box':
            current_component.element = Box(parent, **current_component.props)
            current_component.element.bg = current_component.bg
            if current_component.width is not None:
                current_component.element.width = current_component.width
            for child_index, child in enumerate(current_component.children):
                self.render_node(child, current_component, index=child_index)
        elif current_component.element_type == 'text':
            current_component.element = Text(parent, **current_component.props)
        elif current_component.element_type == 'button':
            current_component.element = PushButton(parent,
                                                   **current_component.props)
            if not (current_component.on_click is None):
                current_component.element.when_clicked = current_component.on_click
        elif current_component.element_type == 'picture':
            current_component.element = Picture(parent,
                                                **current_component.props)
            current_component.element.height = current_component.height
            current_component.element.width = current_component.width

        if parent_component is not None:
            if not includes(parent_component.children, current_component):
                parent_component.children.append(current_component)

        self.__elements.append(current_component)
Exemplo n.º 28
0
def test_alt_values():
    a = App(layout="grid")
    b = Box(a, layout="grid", grid=[0, 1], align="top")
    assert b.layout == "grid"
    assert b.grid[0] == 0
    assert b.grid[1] == 1
    assert b.align == "top"
    a.destroy()
Exemplo n.º 29
0
def regBefore():
    global app
    app.destroy()
    app = App("tjek ind V1")
    Text(app, "have registratet before?")
    box = Box(app, layout="grid")
    PushButton(box, haveRegBefore, text="yes", grid=[0, 1])
    PushButton(box, willYouReg, text="no", grid=[0, 0])
    app.display()
Exemplo n.º 30
0
def main():
    global tempText, humidBox, picBox, todayTemps, todayPic, todayHum, dayPic, dayText, dayDOWText, descBox, todayDesc, descText
    app = App(title="Weather-inator", layout="grid", width=500, height=600)

    #boxes
    tempBox = Box(app, grid=[0, 0, 5, 1], border=True, width=500, height=400)





    tempText = Text(tempBox, size=32)
    humidBox = Text(tempBox, size=32)
    picBox = Picture(tempBox)
    descBox = Text(tempBox, size=12)
    todayForecastBox = Box(tempBox, layout="grid")
    todayTemps = Text(todayForecastBox,grid=[0,0])
    todayPic = Picture(todayForecastBox, width=100, height=100, grid=[1,0])
    todayHum = Text(todayForecastBox,grid=[2,0])
    todayDesc = Text(todayForecastBox,grid=[0,3,3,1])
    dayDOWText = []
    dayBox = []
    dayPic = []
    dayText = []
    descText = []
    for x in range(0,5):
        dayBox.append(Box(app, grid=[x, 1], border=True, width=100, height=200))
        dayDOWText.append(Text(dayBox[x]))
        dayPic.append(Picture(dayBox[x], width=100, height=100))
        dayText.append(Text(dayBox[x]))
        descText.append(Text(dayBox[x], size=10))




    updateWeather()
    updateForecast()


    app.repeat((10 * 60 * 1000),updateWeather) #update every 10 minutes
    app.repeat((60*60*1000),updateForecast) #update every hour


    app.display()