Пример #1
0
def loadGUI(app, camera):

    # SETTING UP THE GUI
    app.set_full_screen()

    ###################
    # Nuclear options
    btn_closeApp = PushButton(
        app,
        command=closeApp,
        grid=[0, 0, 1, 3],
        image="/home/pi/hqcamera/assets/icons/home.png").tk.config(
            width=194,
            height=234,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#d4351c")
    btn_turnOffDevice = PushButton(
        app,
        command=turnOffDevice,
        grid=[1, 0],
        image="/home/pi/hqcamera/assets/icons/shutdown.png").tk.config(
            width=194,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#d4351c")
    btn_rebootDevice = PushButton(
        app,
        command=rebootDevice,
        grid=[1, 1],
        image="/home/pi/hqcamera/assets/icons/reboot.png").tk.config(
            width=194,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#f47738")
    # btn_deactivateCamera = PushButton(app, command=deactivateCamera, grid=[0,2], image="/home/pi/hqcamera/assets/icons/stopCamera.png").tk.config(width=194, height=74, bd=0, highlightthickness=2, highlightbackground="black", activebackground="#ffdd00", bg="#d4351c")

    ###################
    # Battery icon
    icon_battery = Picture(
        app,
        grid=[1, 4, 1, 2],
        image="/home/pi/hqcamera/assets/icons/batteryunknown.png")
    icon_battery.after(3000, checkBatteryLevel, args=[icon_battery])
    icon_battery.repeat(30000, checkBatteryLevel, args=[icon_battery])
    icon_battery.tk.config(width=194,
                           height=154,
                           bd=0,
                           highlightthickness=2,
                           highlightbackground="black",
                           activebackground="#ffdd00",
                           bg="#000000")

    ###################
    # Shutter button
    btn_takeAPicture = PushButton(
        app,
        command=takeAPicture,
        grid=[0, 3, 1, 3],
        image="/home/pi/hqcamera/assets/icons/capture.png").tk.config(
            width=194,
            height=234,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#0BD318")

    ###################
    # Preview toggles
    btn_startCameraPreview = PushButton(
        app,
        command=startCameraPreview,
        grid=[1, 2],
        image="/home/pi/hqcamera/assets/icons/startPreview.png").tk.config(
            width=194,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#00703c")
    btn_stopCameraPreview = PushButton(
        app,
        command=stopCameraPreview,
        grid=[1, 3],
        image="/home/pi/hqcamera/assets/icons/stopPreview.png").tk.config(
            width=194,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#d4351c")

    ######################
    # Brightness toggles
    icon_brightness = Picture(
        app,
        grid=[2, 0],
        image="/home/pi/hqcamera/assets/icons/brightness.png").tk.config(
            width=158, height=74, bd=0, highlightthickness=0, bg="#000000")
    btn_brightnessReset = PushButton(
        app,
        command=changeBrightness,
        args=["reset"],
        grid=[3, 0],
        image="/home/pi/hqcamera/assets/icons/reset.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")
    btn_brightnessUp = PushButton(
        app,
        command=changeBrightness,
        args=["up"],
        grid=[4, 0],
        image="/home/pi/hqcamera/assets/icons/plus.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")
    btn_brightnessDown = PushButton(
        app,
        command=changeBrightness,
        args=["down"],
        grid=[5, 0],
        image="/home/pi/hqcamera/assets/icons/minus.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")

    ######################
    # Contrast toggles
    icon_contrast = Picture(
        app, grid=[2, 1],
        image="/home/pi/hqcamera/assets/icons/contrast.png").tk.config(
            width=158, height=74, bd=0, highlightthickness=0, bg="#000000")
    btn_contrastReset = PushButton(
        app,
        command=changeContrast,
        args=["reset"],
        grid=[3, 1],
        image="/home/pi/hqcamera/assets/icons/reset.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")
    btn_contrastUp = PushButton(
        app,
        command=changeContrast,
        args=["up"],
        grid=[4, 1],
        image="/home/pi/hqcamera/assets/icons/plus.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")
    btn_contrastDown = PushButton(
        app,
        command=changeContrast,
        args=["down"],
        grid=[5, 1],
        image="/home/pi/hqcamera/assets/icons/minus.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")

    ######################
    # ISO toggles
    icon_iso = Picture(
        app, grid=[2, 2],
        image="/home/pi/hqcamera/assets/icons/iso.png").tk.config(
            width=158, height=74, bd=0, highlightthickness=0, bg="#000000")
    btn_isoAuto = PushButton(
        app,
        command=changeISO,
        args=["auto"],
        grid=[3, 2],
        image="/home/pi/hqcamera/assets/icons/auto.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")
    btn_isoUp = PushButton(
        app,
        command=changeISO,
        args=["up"],
        grid=[4, 2],
        image="/home/pi/hqcamera/assets/icons/plus.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")
    btn_isoDown = PushButton(
        app,
        command=changeISO,
        args=["down"],
        grid=[5, 2],
        image="/home/pi/hqcamera/assets/icons/minus.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")

    ######################
    # Filters toggles
    icon_iso = Picture(
        app, grid=[2, 3],
        image="/home/pi/hqcamera/assets/icons/filter.png").tk.config(
            width=158, height=74, bd=0, highlightthickness=0, bg="#000000")
    btn_filterReset = PushButton(
        app,
        command=changeFilter,
        args=["reset"],
        grid=[3, 3],
        image="/home/pi/hqcamera/assets/icons/reset.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")
    btn_filterPrevious = PushButton(
        app,
        command=changeFilter,
        args=["previous"],
        grid=[4, 3],
        image="/home/pi/hqcamera/assets/icons/previous.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")
    btn_filterNext = PushButton(
        app,
        command=changeFilter,
        args=["next"],
        grid=[5, 3],
        image="/home/pi/hqcamera/assets/icons/next.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")
    # btn_changeFilter = PushButton(app, command=changeFilter, grid=[3,4], image="/home/pi/hqcamera/assets/icons/btn_Camera_FiltersToggle.png").tk.config(width=198, height=74, bd=0, highlightthickness=2, highlightbackground="black", activebackground="#ffdd00", bg="#666666")

    ######################
    # Timer toggles
    icon_timer = Picture(
        app, grid=[2, 4],
        image="/home/pi/hqcamera/assets/icons/timer.png").tk.config(
            width=158, height=74, bd=0, highlightthickness=0, bg="#000000")
    btn_timer3s = PushButton(
        app,
        command=changeTimer,
        args=[3],
        grid=[3, 4],
        image="/home/pi/hqcamera/assets/icons/3s.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")
    btn_timer5s = PushButton(
        app,
        command=changeTimer,
        args=[5],
        grid=[4, 4],
        image="/home/pi/hqcamera/assets/icons/5s.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")
    btn_timer10s = PushButton(
        app,
        command=changeTimer,
        args=[10],
        grid=[5, 4],
        image="/home/pi/hqcamera/assets/icons/10s.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")

    ######################
    # Orientation toggles
    icon_orientation = Picture(
        app,
        grid=[2, 5],
        image="/home/pi/hqcamera/assets/icons/orientation.png").tk.config(
            width=158, height=74, bd=0, highlightthickness=0, bg="#000000")
    btn_orientation = PushButton(
        app,
        command=changeOrientation,
        args=["minus"],
        grid=[3, 5],
        image="/home/pi/hqcamera/assets/icons/orientminus90.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")
    btn_orientation = PushButton(
        app,
        command=changeOrientation,
        args=["reset"],
        grid=[4, 5],
        image="/home/pi/hqcamera/assets/icons/orient0.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")
    btn_orientations = PushButton(
        app,
        command=changeOrientation,
        args=["plus"],
        grid=[5, 5],
        image="/home/pi/hqcamera/assets/icons/orientplus90.png").tk.config(
            width=74,
            height=74,
            bd=0,
            highlightthickness=2,
            highlightbackground="black",
            activebackground="#ffdd00",
            bg="#666666")

    app.display()
Пример #2
0
def startup():
    global display_picture
    display_picture = Picture(app, image="tesla.gif")
    display_picture.after(9000, hide_it)
Пример #3
0
from guizero import App, PushButton, Text, TextBox, Picture
import time


def hide_it():
    display_picture.hide()


picture_list = [
    "ModelXGif.gif", "Model3Gif.gif", "ModelSGif.gif", "ModelYGif.gif"
]
index = 0
app = App(title="GUI Tesla Ordering", bg="lavender")
display_text = Text(app, text="Order a Tesla", color="dodger blue")

display_picture = Picture(app, image="tesla.gif")
display_picture.after(2000, hide_it)
app.display()
Пример #4
0
            currentFrame = currentFrame + 1
            picture.value = home_path + str(
                currentFrame) + config['SplashScreen']['imageFile']
            picture.after(
                int(config['SplashScreen']['animateSecondsPerFrame']) * 1000,
                nextFrame)

    currentFrame = 1
    picture = Picture(splashApp,
                      image=home_path + str(currentFrame) +
                      config['SplashScreen']['imageFile'])
    # scale the picture so its the same as the app
    picture.width = splashApp.width
    picture.height = splashApp.height
    timer = picture.after(
        int(config['SplashScreen']['animateSecondsPerFrame']) * 1000,
        nextFrame)  # kick off the animation
    splashApp.when_key_pressed = onKeyPress
    splashApp.when_clicked = onClick
    splashApp.display()

#### IDE Launch ####

# Take the starter file and move it into place, overwriting the file that's there:
shutil.copyfile(
    home_path + config['Activity']['starterFile'],
    config['Activity']['newFileLocation'] + config['Activity']['newFileName'])

# Update launch count in the config file:
count = int(config['Data']['count'])
count = count + 1