예제 #1
0
def start_download_thread():
    download_thread = threading.Thread(target=get_video)
    download_thread.start()
    push_btn.destroy()
    global loading_text
    loading_text = guizero.Text(app, text="Loading...")
    if not download_thread.isAlive():
        print("DONE")
    try:
        try_again.destroy()
        loading_text = guizero.Text(app, text="Loading...")
    except:
        pass
예제 #2
0
def main():
    # making entertask a global variable so we can access its value from any method
    global enterTask
    global box

    enterTask = guizero.TextBox(app, text="Enter a Task", width=50)

    guizero.Text(app, text=" ")
    guizero.PushButton(app, command=addTask, text="Add Task")

    showAll()

    # drawing elements in the bottom of the screen
    # creating a box object to align to the bottom of the screen
    box = guizero.Box(app, width="fill", align="bottom")
    guizero.PushButton(box,
                       text="Delete All",
                       align="right",
                       command=deleteAll)
    guizero.PushButton(box,
                       text="Delete Selected",
                       align="right",
                       command=removeTask)
    guizero.PushButton(box,
                       text="Complete task",
                       align="left",
                       command=completeTask)
예제 #3
0
def LEDpowerOFF():
	if LEDpowerselect.value != None:
		filewrite.write(str(LEDpowerselect.value) + ".off()\n")
		LEDcontrolwindow.hide()
		Actionlog.append("LED " + str(LEDpowerselect.value) + " will turn OFF")
	else:
		NoLEDselect = guizero.Text(LEDcontrolwindow, text = "Invalid selection", align = "top")
예제 #4
0
    def __init__(self, app):
        self.about_text = app_variables.about_window_text_file_location

        self.window = guizero.Window(
            app,
            title="About || KootNet Sensors - Control Center",
            width=610,
            height=325,
            layout="grid",
            visible=False)

        self.about_text1 = guizero.Text(self.window,
                                        text=app_variables.software_version,
                                        grid=[1, 1],
                                        align="right")

        self.about_textbox = guizero.TextBox(self.window,
                                             text="About",
                                             grid=[1, 2],
                                             width=75,
                                             height=18,
                                             multiline=True,
                                             align="left")

        # Window Tweaks
        self.window.tk.resizable(False, False)
        self._set_about_text()
        self.about_textbox.disable()
        self.about_textbox.bg = "black"
        self.about_textbox.text_color = "white"
예제 #5
0
def photoUpload():
    
    box1=guizero.Box(app, layout="grid")
    text1=guizero.Text(box1,text="Hvor mange minutter skal der filmes? ", grid=[0,0])
    minutes=guizero.TextBox(box1,text="", grid=[1,0])
    minutes.focus()
    text2=guizero.Text(box1, text="hvor mange sekunder mellem hvert billede? ",grid=[0,1])
    timelapse=guizero.TextBox(box1,text="", grid=[1,1])
    text3=guizero.Text(box1, text="filnavn ? ",grid=[0,2])
    filename=guizero.TextBox(box1,text="", grid=[1,2])
    text4=guizero.Text(box1, text=("størrelse: "),grid=[0,3])
    picsize=guizero.Slider(box1, start=640, end=3280, grid=[1,3])
    
    
       
    
    button1=guizero.PushButton(box1, command=lambda:printit(minutes.get(),timelapse.get(),filename.get()), text="Submit",grid=[1,5])
예제 #6
0
def get_video():
    link = get_link_val()
    try:
        video = YouTube(str(link))
        title = video.title
        thumbnail_response = requests.get(video.thumbnail_url)
        img = Image.open(BytesIO(thumbnail_response.content))
        quality = video.streams.filter(progressive=True)
        global selected_quality
        selected_quality = [items.resolution for items in quality]
    except pytube.exceptions.RegexMatchError:
        #global video_box
        video_box.width = "fill"
        guizero.Text(video_box, text=" ")
        txt = guizero.Text(video_box,
                           text="Please enter a valid YouTube video link")
    except urllib.error.URLError:
        video_box.width = "fill"
        guizero.Text(video_box, text=" ")
        txt = guizero.Text(
            video_box,
            text="Please check your internet connection and try again")
        guizero.Text(video_box, text=" ")
        global try_again
        try_again = guizero.PushButton(app,
                                       text="Try again",
                                       command=start_download_thread)
        guizero.Text(app, text=" ")
    else:
        #global video_box
        picture_box = guizero.Box(video_box,
                                  align="left",
                                  width=100,
                                  height="fill")
        info_box = guizero.Box(video_box,
                               align="right",
                               width=display_width - 100,
                               height="fill")
        thumbnail = guizero.Picture(picture_box,
                                    image=img,
                                    align="left",
                                    width=100,
                                    height=100)
        title = guizero.Text(info_box, text=title, width="fill")
        download_box = guizero.Box(info_box, width=75, height=50)
        global qualities
        download_btn = guizero.PushButton(download_box,
                                          text="Download",
                                          command=download_video,
                                          args=[
                                              quality[selected_quality.index(
                                                  qualities.value)],
                                              os.getcwd(), title
                                          ])
        qualities = guizero.ListBox(
            info_box,
            items=[item.resolution for item in quality],
            width=100,
            height=100)
    loading_text.destroy()
예제 #7
0
def open_image():
    global input_box
    global return_box
    metadata = None
    return_box = guizero.Box(app, width="fill")
    try:
        # using PIl to open image
        img = Image.open(input_box.value)
        # opening pyexiv2 instance from image
        meta = Meta(input_box.value)
        # opening the instance like this so that we don't close it after reading metadata so object is still in memory, although this can cause a memory leak

        # with Meta(input_box.value) as meta: -> using this method will delete the object and we will no longer have access to it in the clear meta function
        metadata = meta.read_exif()
        message = guizero.Text(return_box, text="")
        thumbnail = guizero.Picture(return_box,
                                    image=img,
                                    width=100,
                                    height=100)
        message = guizero.Text(return_box, text="")
        if not metadata:
            # picture has no metadata
            listbox = guizero.ListBox(return_box,
                                      items=["No metadata was extracted"],
                                      width="fill",
                                      height=50)
        else:
            listbox = guizero.ListBox(return_box, items=[], width="fill")
            cancel = guizero.PushButton(buttons_box,
                                        text="Strip Metadata",
                                        align="right",
                                        command=clear_meta,
                                        args=[meta])
            for _ in metadata.items():
                # add each item in metadata to listbox
                listbox.append(f"{_[0]}:     {_[1]}")
    except FileNotFoundError:
        message = guizero.Text(return_box, text="")
        thumbnail = guizero.Picture(return_box,
                                    image=f'error.jpeg',
                                    width=200,
                                    height=200)
        message = guizero.Text(return_box, text="")
        message = guizero.Text(return_box, text="Image not found")
예제 #8
0
def Picameraconfirmcapture():
	if Picamerawindowfilebox.value != "":
		filewrite.write("time.sleep(5) # Camera warm up time, is necessary\ncamera.capture(\"" + str(Picamerawindowfilebox.value) + "\")\n")
		Actionlog.append("PiCamera will capture image " + str(Picamerawindowfilebox.value))
		Picamerawindowfilebox.clear()
		Picamerawindow.hide()
		Morecomponentswindow.hide()
	else:
		Invalidimagename = guizero.Text(Picamerawindow, text = "Invalid Input", align = "bottom")
		Picamerawindowfilebox.clear()
예제 #9
0
def updateSleeptime():
	if Sleeptimebox.value != "":
		Sleeptime = Sleeptimebox.value
		filewrite.write("time.sleep(" + str(Sleeptime) + ")\n" )
		Sleeptimebox.clear()
		Sleepwindow.hide()
		Morecomponentswindow.hide()
		Actionlog.append("Added sleep timer for "+ str(Sleeptime) + " seconds")
	else:
		NoSleepinputtext = guizero.Text(Sleepwindow, text = "Invalid input")
예제 #10
0
def PWMLEDcontrolbrightness():
	if ((PWMLEDpowerselect.value !=None ) and (PWMbrightinputbox.value != "")):
		PWMbrightinput = float(PWMbrightinputbox.value)
		filewrite.write(str(PWMLEDpowerselect.value) + ".value = " + str(PWMbrightinput) + "\ntime.sleep(10)\n" + str(PWMLEDpowerselect.value) + ".value = 0")
		#10 second brightness timer. Can be changed by user
		Actionlog.append("PWMLED " + str(PWMLEDpowerselect.value) + " brightness set to " + str(PWMbrightinput))
		PWMLEDcontrolwindow.hide()
	elif PWMLEDpowerselect.value == None:
		NoLEDselect = guizero.Text(PWMLEDcontrolwindow, text = "Invalid selection", align = "top")
	else:
		pass
예제 #11
0
def updatePWMLEDname():
	invalidpwmledpinlist = ["1", "2", "4", "17"]
	if PWMLEDnamebox.value != "" and (PWMLEDpinnumberbox.value != "" and int(PWMLEDpinnumberbox.value) < 41 and int(PWMLEDpinnumberbox.value) > 0) and PWMLEDpinnumberbox.value not in invalidpwmledpinlist:
		PWMLEDpowerselect.append(str(PWMLEDnamebox.value))
		filewrite.write(str(PWMLEDnamebox.value) + " = PWMLED(" + str(PWMLEDpinnumberbox.value) + ")\n")
		Actionlog.append("Added PWMLED with name " + str(PWMLEDnamebox.value) + " at GPIO pin " + str(PWMLEDpinnumberbox.value))
		PWMLEDnamebox.clear()
		PWMLEDpinnumberbox.clear()
		PWMLEDwindow.hide()
	else:
		NoPWMLEDwarntext = guizero.Text(PWMLEDwindow, text = "Invalid input", align = "top")
예제 #12
0
def ConfirmSenseHattext():
	validrotationlist = ["0","90","180","270"]
	if SenseHatmatrixcustomtextbox.value != "" and SenseHatmatrixcustomtextsenserotationbox.value in validrotationlist:
		filewrite.write("sensehat.set_rotation(" + str(SenseHatmatrixcustomtextsenserotationbox.value) + ")\n")
		filewrite.write("sensehat.show_message(\""+ str(SenseHatmatrixcustomtextbox.value) + "\")\n")
		Actionlog.append("SenseHat will be rotated " + str(SenseHatmatrixcustomtextsenserotationbox.value) + " degrees")
		Actionlog.append("SenseHat will display text " + str(SenseHatmatrixcustomtextbox.value))
		SenseHatmatrixcustomtextwindow.hide()
		SenseHatmatrixcustomtextbox.clear()
		Morecomponentswindow.hide()
	else:
		Invalidcustomtextinputtext = guizero.Text(SenseHatmatrixcustomtextwindow, text = "Invalid Input")
예제 #13
0
def updateButtonname():
	invalidbuttonpinlist = ["1", "2", "4", "17"]
	Buttonname = Buttonnamebox.value
	Buttonpinnumber = Buttonpinnumberbox.value
	if Buttonnamebox.value != "" and Buttonpinnumberbox.value != "" and Buttonpinnumberbox.value not in invalidbuttonpinlist:
		Buttoncontrolbuttonselect.append(str(Buttonname))
		filewrite.write( str(Buttonname) + " = Button(" + str(Buttonpinnumber) + ")\n")
		Buttonnamebox.clear()
		Buttonpinnumberbox.clear()
		Buttonwindow.hide()
		Actionlog.append("Added Button with name " + str(Buttonname) + " at GPIO pin " + str(Buttonpinnumber))
	else:
		NoButtonwarntext = guizero.Text(Buttonwindow, text = "Invalid input", align = "top")
예제 #14
0
def updateLEDname():
	invalidledpinlist = ["1", "2", "4", "17"]
	if LEDnamebox.value != "" and (LEDpinnumberbox.value != "" and int(LEDpinnumberbox.value) > 0 and int(LEDpinnumberbox.value) < 41) and LEDpinnumberbox.value not in invalidledpinlist:
		LEDpowerselect.append(str(LEDnamebox.value))
		ButtoncontrolLEDselect.append(str(LEDnamebox.value))
		LEDBoardselect.append(str(LEDpinnumberbox.value))
		filewrite.write(str(LEDnamebox.value) + " = LED(" + str(LEDpinnumberbox.value) + ")\n")
		Actionlog.append("Added LED with name " + str(LEDnamebox.value) + " at GPIO pin " + str(LEDpinnumberbox.value))
		LEDnamebox.clear()
		LEDpinnumberbox.clear()
		LEDwindow.hide()
	else:
		NoLEDwarntext = guizero.Text(LEDwindow, text = "Invalid input", align = "top")
예제 #15
0
def updateLEDBoard():
	if LEDBoardnamebox.value != "" and LEDBoardselect.value != None:
		ledstring = "" #Sets the led string to "". each led pin is added to the string
		for traverser in LEDBoardselect.value[0 : -1]:
			ledstring = ledstring + traverser + ", "
		ledstring = ledstring + LEDBoardselect.value[-1]
		filewrite.write(str(LEDBoardnamebox.value) + " = LEDBoard(" + ledstring + ")\n") #the string of LED pins is added to the file after LEDBoard = (
		Actionlog.append("Created LEDBoard with LEDs at pins " + str(LEDBoardselect.value))
		ButtoncontrolLEDselect.append(str(LEDBoardnamebox.value))
		LEDpowerselect.append(str(LEDBoardnamebox.value))
		LEDBoardnamebox.clear()
		LEDBoardwindow.hide()
	else:
		InvalidLEDBoardtext = guizero.Text(LEDBoardwindow, text = "Invalid Input", align = "bottom")
예제 #16
0
def forward(step, road, n, windows):
    global n_steps
    global xd
    global yd
    n -= 1
    if n_steps != n + 1:

        xd, yd = direct(step[n_steps], xd, yd)
        road[xd, yd].bg = 'green'
        guizero.Text(windows, grid=[xd, 14 - yd], text=n_steps + 1, bg='green')
        n_steps += 1
    else:
        if guizero.yesno(title='', text='You want to go out?') == 1:
            windows.destroy()
예제 #17
0
def showAll():
    """
    Function to display all tasks in the database to the GUI
    : return: None
    """
    global task
    # making task a global variable so it can be accessed from all methods throughout the code

    guizero.Text(app, text='')
    task = guizero.ListBox(app, scrollbar=True, width=750, height=450)

    for item in database.retrieve_all():
        comp = ['Completed' if item[4] == 'True' else 'Pending']
        #txt = guizero.Text(task, text=f"{item[0]}. {item[1]}            {comp[0]}")
        task.insert('end', f"{item[0]}. {item[1]}            {comp[0]}")
예제 #18
0
def main():
    guizero.Text(app, text=" ")
    guizero.Text(app, text="Youtube Video Downloader")
    guizero.Text(app, text=" ")
    guizero.Text(app, text="Insert the video link below")
    guizero.Text(app, text=" ")
    global video_link
    video_link = guizero.TextBox(app, width=int(display_width * 0.1))
    guizero.Text(app, text=" ")
    global push_btn
    push_btn = guizero.PushButton(app,
                                  text="Search Video",
                                  command=start_download_thread)
    global video_box
    video_box = guizero.Box(app, width=int(display_width - 100), height=100)
예제 #19
0
def ConfirmSenseHaticon():
	mledscanner = 0
	for mled in SenseHarmatrixmledlist:
		if mled.value in SenseHatmatrixcustomiconvalidinputslist:
			mledscanner = mledscanner + 1
			if mledscanner == 64:
				filewrite.write("icon = [\n")
				filewrite.write("   " + str(mled1x1.value) + ", " + str(mled2x1.value) + ", " + str(mled3x1.value) + ", " + str(mled4x1.value) + ", " + str(mled5x1.value) + ", " + str(mled6x1.value) + ", " + str(mled7x1.value) + ", " + str(mled8x1.value) + ", \n")
				filewrite.write("   " + str(mled1x2.value) + ", " + str(mled2x2.value) + ", " + str(mled3x2.value) + ", " + str(mled4x2.value) + ", " + str(mled5x2.value) + ", " + str(mled6x2.value) + ", " + str(mled7x2.value) + ", " + str(mled8x2.value) + ", \n")
				filewrite.write("   " + str(mled1x3.value) + ", " + str(mled2x3.value) + ", " + str(mled3x3.value) + ", " + str(mled4x3.value) + ", " + str(mled5x3.value) + ", " + str(mled6x3.value) + ", " + str(mled7x3.value) + ", " + str(mled8x3.value) + ", \n")
				filewrite.write("   " + str(mled1x4.value) + ", " + str(mled2x4.value) + ", " + str(mled3x4.value) + ", " + str(mled4x4.value) + ", " + str(mled5x4.value) + ", " + str(mled6x4.value) + ", " + str(mled7x4.value) + ", " + str(mled8x4.value) + ", \n")
				filewrite.write("   " + str(mled1x5.value) + ", " + str(mled2x5.value) + ", " + str(mled3x5.value) + ", " + str(mled4x5.value) + ", " + str(mled5x5.value) + ", " + str(mled6x5.value) + ", " + str(mled7x5.value) + ", " + str(mled8x5.value) + ", \n")
				filewrite.write("   " + str(mled1x6.value) + ", " + str(mled2x6.value) + ", " + str(mled3x6.value) + ", " + str(mled4x6.value) + ", " + str(mled5x6.value) + ", " + str(mled6x6.value) + ", " + str(mled7x6.value) + ", " + str(mled8x6.value) + ", \n")
				filewrite.write("   " + str(mled1x7.value) + ", " + str(mled2x7.value) + ", " + str(mled3x7.value) + ", " + str(mled4x7.value) + ", " + str(mled5x7.value) + ", " + str(mled6x7.value) + ", " + str(mled7x7.value) + ", " + str(mled8x7.value) + ", \n")
				filewrite.write("   " + str(mled1x8.value) + ", " + str(mled2x8.value) + ", " + str(mled3x8.value) + ", " + str(mled4x8.value) + ", " + str(mled5x8.value) + ", " + str(mled6x8.value) + ", " + str(mled7x8.value) + ", " + str(mled8x8.value) + "\n")
				filewrite.write("]\n\n")#Double \n for making it pretty!!
				filewrite.write("sensehat.set_pixels(icon)\n")
				mled.clear()
				SenseHatmatrixcustomiconwindow.hide()
				Actionlog.append("SenseHat matrix will display custom icon")
			else:
				pass
	else:
		Invalidiconinputtext = guizero.Text(SenseHatmatrixcustomiconwindow, text = "Invalid Input", grid = [10,12], align = "bottom")
예제 #20
0
def Buttoncontrolconfirmaction():
	#This is going to be big...turns out not!
	if Buttoncontrolbuttonselect.value == None or Buttoncontrolbuttonactionselect.value ==None or ButtoncontrolLEDselect.value == None or ButtoncontrolLEDactionselect.value == None:
		Nobuttonselecttext = guizero.Text(Buttoncontrolwindow, text = "No selection made. Try again")
	else:
		if Buttoncontrolbuttonactionselect.value == "when pressed":
			if ButtoncontrolLEDactionselect.value == "Turn ON":
				filewrite.write(str(Buttoncontrolbuttonselect.value) + ".when_pressed = " + str(ButtoncontrolLEDselect.value) + ".on()\n")
				Actionlog.append("LED " + str(ButtoncontrolLEDselect.value) + " will turn ON when button " + str(Buttoncontrolbuttonselect.value) + " is pressed")
			elif ButtoncontrolLEDactionselect.value == "Turn OFF":
				filewrite.write(str(Buttoncontrolbuttonselect.value) + ".when_pressed = " + str(ButtoncontrolLEDselect.value) + ".off()\n")
				Actionlog.append("LED " + str(ButtoncontrolLEDselect.value) + " will turn OFF when button " + str(Buttoncontrolbuttonselect.value) + " is pressed")
			else:
				pass
		elif Buttoncontrolbuttonactionselect.value == "when released":
			if ButtoncontrolLEDactionselect.value == "Turn ON":
				filewrite.write(str(Buttoncontrolbuttonselect.value) + ".when_released = " + str(ButtoncontrolLEDselect.value) + ".on()\n")
				Actionlog.append("LED " + str(ButtoncontrolLEDselect.value) + " will turn ON when button " + str(Buttoncontrolbuttonselect.value) + " is released")
			elif ButtoncontrolLEDactionselect.value == "Turn OFF":
				filewrite.write(str(Buttoncontrolbuttonselect.value) + ".when_released = " + str(ButtoncontrolLEDselect.value) + ".off()\n")
				Actionlog.append("LED " + str(ButtoncontrolLEDselect.value) + " will turn OFF when button " + str(Buttoncontrolbuttonselect.value) + " is released")
			else:
				pass
		Buttoncontrolwindow.hide()
def end_app():
    logger.info('Game Exit!!!!')
    big_game.game_exit()
    app.destroy()
    loop.quit()


if __name__ == '__main__':
    logger.debug('Debug On!!!!')
    app = guizero.App("Big Button Project",
                      layout='grid',
                      width='600',
                      height='300')
    big_game = big_button_project.ButtonGame()
    title = guizero.Text(app, text='Big Button Game', size=24, grid=[0, 1])
    button = guizero.PushButton(app,
                                big_game.game_start,
                                text='Start',
                                grid=[1, 1])
    active = guizero.TextBox(app, text='', width=20, grid=[2, 1])
    active.configure(background=big_game.btn_active)
    score_lbl = guizero.Text(app, text='Score:', size=36, grid=[3, 0])
    score = guizero.Text(app, text=big_game.score, size=36, grid=[3, 2])
    game_over = guizero.PushButton(app, end_app, text='Exit', grid=[4, 1])

    GLib.idle_add(refresh_app)
    try:
        loop.run()
    except KeyboardInterrupt:
        end_app()
예제 #22
0
#!/usr/bin/env python3

import guizero

app = guizero.App(title="My second GUI app",
                  width=300,
                  height=200,
                  layout="grid")

combo_label = guizero.Text(app, text="Which film?", grid=[0, 0], align='left')
film_choice = guizero.Combo(app,
                            options=['Star Wars', 'Frozen', 'Lion King'],
                            grid=[1, 0],
                            align="left")

cbox_label = guizero.Text(app, text="Seat Type", grid=[0, 1], align='left')
vip_seat = guizero.CheckBox(app, text="VIP seat?", grid=[1, 1], align='left')

row_choice = guizero.ButtonGroup(app,
                                 options=[["Front", "F"], ["Middle", "M"],
                                          ["Back", "B"]],
                                 selected="M",
                                 horizontal=True,
                                 grid=[1, 2],
                                 align="left")


def do_booking():
    print(film_choice.value)
    print(vip_seat.value)
    print(row_choice.value)
"""GUI Widget Presentation: Widget Alignment
   ITN 160 Programming I
   11/16/2019"""


# Import guizero library
import guizero
from guizero import *


# Create the widget that will contain the aligned text
app = guizero.App(title='GUI Widget Alignment', width=500, height=500)

# Set the alignment, size, and color for the "Top Alignment" text
top_alignment = guizero.Text(app, text='TOP ALIGNMENT', align='top')
top_alignment.text_color = 'crimson'
top_alignment.text_size = 15

# Set the alignment, size, and color for the "Bottom Alignment" text
bottom_alignment = guizero.Text(app, text='BOTTOM ALIGNMENT', align='bottom')
bottom_alignment.text_color = 'dark violet'
bottom_alignment.text_size = 15

# Set the alignment, size, and color for the "Left Alignment" text
buttn1 = PushButton(app, align='right')
left_alignment = guizero.Text(app, text='LEFT ALIGNMENT', align='left')
left_alignment.text_color = 'blue2'
left_alignment.text_size = 15

# Set the alignment and size for the "Right Alignment" text
right_alignment = guizero.Text(app, text='RIGHT ALIGNMENT', align='right')
예제 #24
0
def Hflipsensematrix():
	filewrite.write("sensehat.flip_h()\n")
	Actionlog.append("SenseHat matrix display flipped horizontally")
	Sensematrixhflippedtext = guizero.Text(SenseHatmatrixcustomtextwindow, text = "SenseHat matrix display flipped horizontally")
예제 #25
0
def Vflipsensematrix():
	filewrite.write("sensehat.flip_v()\n")
	Actionlog.append("SenseHat matrix display flipped vertically")
	Sensematrixvflippedtext = guizero.Text(SenseHatmatrixcustomtextwindow, text = "SenseHat matrix display flipped vertically")
예제 #26
0
		InvalidLEDBoardtext = guizero.Text(LEDBoardwindow, text = "Invalid Input", align = "bottom")

def LEDBoardexit():
	LEDBoardnamebox.clear()
	LEDBoardwindow.hide()

def Disclaimerdecline():
	Disclaimerwindow.destroy()
	mainwindow.destroy()

#All widgets based on window

#Disclaimerwindow
Disclaimerdeclinebutton = guizero.PushButton(Disclaimerwindow, command = Disclaimerdecline, text = "Exit", align = "bottom", padx = 38)
Disclaimeracceptbutton = guizero.PushButton(Disclaimerwindow, command = Disclaimeraccept, text = "I understand", align = "bottom")
Disclaimertext1 = guizero.Text(Disclaimerwindow, text = "The creator of this program is not responsible for :\n1)Damage caused to electrical components\n2)Harm caused to the user by electrical components\n3)Loss of functionality of electrical components\n")
Disclaimertext2 = guizero.Text(Disclaimerwindow, text = "Note that the program does not interact with any components\nIt merely creates code which the user can run at their own risk\n")
Disclaimertext3 = guizero.Text(Disclaimerwindow, text = "Program made by arnitdo\ngithub.com/arnitdo")

#Buttonwindow
Buttonnametext = guizero.Text(Buttonwindow, text = "\nName of new Button")
Buttonnamebox = guizero.TextBox(Buttonwindow)
Buttonpinnumbertext = guizero.Text(Buttonwindow, text = "\nNumber of GPIO Pin to which button is connedted")
Buttonpinnumberbox = guizero.TextBox(Buttonwindow)
Buttonselectexitbutton = guizero.PushButton(Buttonwindow, command = Buttonwindowexit, text = "Cancel", align = "bottom", padx = 14)
Buttonnameconfirmbutton = guizero.PushButton(Buttonwindow, command = updateButtonname, text = "Confirm", align = "bottom")

#Buttoncontrolwindow
Buttoncontrolhelptext = guizero.Text(Buttoncontrolwindow, text = "Interface with LEDs using Buttons here\nSelect Button from first list\nSelect trigger from second list\nSelect LED to interact with in third list\nSelect LED power option in the fourth list\nNote that Buttons and LEDs need to be created / defined first" )
Buttoncontrolbuttonselect = guizero.ListBox(Buttoncontrolwindow, items = [], scrollbar = True, height = 75, width = 150, align = "top")
Buttoncontrolbuttonactionselect = guizero.ListBox(Buttoncontrolwindow, items = ["when pressed", "when released"], scrollbar = True, height = 75, width = 150, align = "top")
    def __init__(self, app, ip_selection, current_config):
        self.ip_selection = ip_selection
        self.current_config = current_config
        self.readable_column_names = app_variables.CreateSQLColumnsReadable()
        self.sql_columns = app_variables.CreateSQLColumnNames()

        self.window = guizero.Window(app,
                                     title="Remote Sensor Display",
                                     width=275,
                                     height=400,
                                     layout="grid",
                                     visible=False)

        self.text_temperature_offset = guizero.Text(self.window,
                                                    text="Env Temp Offset:",
                                                    color='green',
                                                    grid=[1, 11],
                                                    align="left")

        self.textbox_temperature_offset = guizero.TextBox(self.window,
                                                          text="",
                                                          width=5,
                                                          grid=[2, 11],
                                                          align="left")

        self.checkbox_default_offset = guizero.CheckBox(
            self.window,
            text="Use Sensor\nDefault",
            command=self._click_checkbox_offset,
            grid=[2, 11],
            align="right")

        self.checkbox_custom_text = guizero.CheckBox(
            self.window,
            text="Text Message",
            command=self._text_checkbox,
            grid=[1, 16],
            align="left")

        self.checkbox_master = guizero.CheckBox(self.window,
                                                text="All Sensors",
                                                command=self._master_checkbox,
                                                grid=[2, 16],
                                                align="left")

        self.text_space1 = guizero.Text(self.window,
                                        text=" ",
                                        grid=[1, 17],
                                        align="left")

        self.checkbox_up_time = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.system_uptime,
            args=[self.sql_columns.system_uptime],
            grid=[1, 27],
            align="left")

        self.checkbox_cpu_temp = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.cpu_temp,
            args=[self.sql_columns.cpu_temp],
            grid=[1, 28],
            align="left")

        self.checkbox_temperature = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.environmental_temp,
            args=[self.sql_columns.environmental_temp],
            grid=[1, 29],
            align="left")

        self.checkbox_pressure = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.pressure,
            args=[self.sql_columns.pressure],
            grid=[1, 30],
            align="left")

        self.checkbox_altitude = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.altitude,
            args=[self.sql_columns.altitude],
            grid=[1, 31],
            align="left")

        self.checkbox_humidity = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.humidity,
            args=[self.sql_columns.humidity],
            grid=[1, 32],
            align="left")

        self.checkbox_distance = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.distance,
            args=[self.sql_columns.distance],
            grid=[1, 33],
            align="left")

        self.checkbox_gas = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.gas,
            args=[self.sql_columns.gas],
            grid=[1, 34],
            align="left")

        self.checkbox_particulate_matter = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.particulate_matter,
            args=[self.sql_columns.particulate_matter],
            grid=[2, 27],
            align="left")

        self.checkbox_lumen = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.lumen,
            args=[self.sql_columns.lumen],
            grid=[2, 28],
            align="left")

        self.checkbox_colour = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.colours,
            args=[self.sql_columns.rgb],
            grid=[2, 29],
            align="left")

        self.checkbox_ultra_violet = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.ultra_violet,
            args=[self.sql_columns.ultra_violet],
            grid=[2, 30],
            align="left")

        self.checkbox_acc = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.accelerometer_xyz,
            args=[self.sql_columns.accelerometer_xyz],
            grid=[2, 31],
            align="left")

        self.checkbox_mag = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.magnetometer_xyz,
            args=[self.sql_columns.magnetometer_xyz],
            grid=[2, 32],
            align="left")

        self.checkbox_gyro = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.gyroscope_xyz,
            args=[self.sql_columns.gyroscope_xyz],
            grid=[2, 33],
            align="left")

        self.text_space4 = guizero.Text(self.window,
                                        text=" ",
                                        grid=[1, 45],
                                        align="right")

        self.button_send_to_display = guizero.PushButton(
            self.window,
            text="Show Reading\non Remote\nSensor Display",
            command=self._remote_sensor_display_selection,
            grid=[1, 46, 2, 1],
            align="top")

        # Window Tweaks
        self.window.tk.resizable(False, False)
        self.checkbox_default_offset.value = 1
        self._set_config()
        self._click_checkbox_offset()
        self.checkbox_up_time.value = 0
        self.checkbox_temperature.value = 0
        self.checkbox_pressure.value = 0
        self.checkbox_humidity.value = 0
        self.checkbox_lumen.value = 0
        self.checkbox_colour.value = 0
예제 #28
0
파일: motors2.py 프로젝트: x41tilla/tripipy
            raise ValueError("speed oops " + rspeed)
        if rtype == 'goto target':
            posn = self.mfields['targetpos'].getValue()
            print('doit', rtype, posn, speed)
            self.motor.goto(targetpos=posn, speed=speed)
        elif rtype in ('run forward', 'run reverse'):
            self.motor.setspeed(
                speed=speed if rtype == 'run forward' else -speed)
        else:
            raise ValueError('rtype oops ' + rtype)


app = gz.App(title="Motor testing")
starttime = time.time()
header = gz.Box(app, align='top', width='fill')
elapsed = gz.Text(header, text="clock here", align='right')
mpanel = gz.Box(app, align='left', layout='grid')

pfields = {}
for y, field in enumerate(motorfields):
    l = field[1](mpanel, grid=[0, y], **field[2])
    pfields[field[0]] = {
        'y': y,
        'class': field[3],
        'kwargs': field[4],
    }
motorpan = motorPanel(motor=chipdrive.tmc5130(),
                      gridx=1,
                      pfields=pfields,
                      panel=mpanel)  #loglvl='rawspi'
app.repeat(1000, ticker)
    def __init__(self, app, ip_selection, current_config, database_or_sensor):
        self.database_or_sensor = database_or_sensor
        self.current_config = current_config
        self.ip_selection = ip_selection
        self.selected_ip = ""
        self.db_location = ""
        self.database_notes = []
        self.database_notes_dates = []
        self.database_user_note_dates = []

        self.text_variables_generic = CreateGenericNoteVariables()
        self.text_variables_sensor = CreateSensorNoteVariables()
        self.text_variables_database = CreateDatabaseNoteVariables()

        self.sql_column_names = app_variables.CreateSQLColumnNames()
        self.network_send_commands = app_variables.CreateNetworkSendCommands()
        self.sensor_get_commands = app_variables.CreateNetworkGetCommands()

        self.window = guizero.Window(app,
                                     title=self.text_variables_database.window_title,
                                     width=580,
                                     height=525,
                                     layout="grid",
                                     visible=False)

        self.text_connected_to = guizero.Text(self.window,
                                              text=self.text_variables_database.text_connected_to,
                                              color="red",
                                              size=8,
                                              grid=[1, 1, 3, 1],
                                              align="left")

        self.checkbox_use_current_datetime = guizero.CheckBox(self.window,
                                                              text=self.text_variables_generic.checkbox_enable_datetime,
                                                              command=self._reset_datetime,
                                                              grid=[4, 1, 5, 1],
                                                              align="left")

        self.button_connect = guizero.PushButton(self.window,
                                                 text=self.text_variables_database.button_connect,
                                                 command=self._open_database,
                                                 grid=[1, 5],
                                                 align="left")

        self.button_back_note = guizero.PushButton(self.window,
                                                   text="Back",
                                                   command=self._back_button,
                                                   grid=[2, 5],
                                                   align="left")

        self.text_note_current = guizero.Text(self.window,
                                              text=self.text_variables_generic.text_note_current,
                                              color="blue",
                                              grid=[3, 5],
                                              align="top")

        self.textbox_on_number_notes = guizero.TextBox(self.window,
                                                       text="0",
                                                       width=5,
                                                       grid=[3, 5],
                                                       align="bottom")

        self.text_date_label1 = guizero.Text(self.window,
                                             text=self.text_variables_generic.text_date_label1,
                                             color="blue",
                                             grid=[4, 5],
                                             align="top")

        self.textbox_note_date = guizero.TextBox(self.window,
                                                 text=self.text_variables_generic.textbox_note_date,
                                                 grid=[4, 5],
                                                 width=23,
                                                 align="bottom")

        self.text_total_notes_label = guizero.Text(self.window,
                                                   text=self.text_variables_generic.text_total_notes_label,
                                                   color="blue",
                                                   grid=[5, 5],
                                                   align="top")

        self.textbox_total_notes = guizero.TextBox(self.window,
                                                   text="0",
                                                   width=5,
                                                   grid=[5, 5],
                                                   align="bottom")

        self.button_next_note = guizero.PushButton(self.window,
                                                   text=self.text_variables_generic.button_next_note,
                                                   command=self._next_button,
                                                   grid=[6, 5],
                                                   align="left")

        self.textbox_current_note = guizero.TextBox(self.window,
                                                    text=self.text_variables_database.textbox_current_note,
                                                    width=70,
                                                    height=25,
                                                    grid=[1, 10, 6, 1],
                                                    multiline=True,
                                                    scrollbar=True,
                                                    align="left")

        self.button_new_note = guizero.PushButton(self.window,
                                                  text=self.text_variables_generic.button_new_note,
                                                  command=self._database_add_note_button,
                                                  grid=[1, 12],
                                                  align="left")

        self.button_delete_note = guizero.PushButton(self.window,
                                                     text=self.text_variables_generic.button_delete_note,
                                                     command=self._database_delete_button,
                                                     grid=[4, 12],
                                                     align="left")

        self.button_update_note = guizero.PushButton(self.window,
                                                     text=self.text_variables_generic.button_update_note,
                                                     command=self._database_update_note_button,
                                                     grid=[5, 12, 2, 1],
                                                     align="left")

        # Window Tweaks
        self.window.tk.resizable(False, False)
        self._disable_notes_window_functions()
        self.checkbox_use_current_datetime.value = True
        self.textbox_current_note.bg = "black"
        self.textbox_current_note.text_color = "white"
        self.textbox_current_note.tk.config(insertbackground="red")

        if database_or_sensor == self.text_variables_generic.sensor_notes_verification:
            self._change_for_sensor()
예제 #30
0
    pass


def videoNoUpload():
    pass


app = guizero.App(title="Surveillance tools")

menu = guizero.MenuBar(app,
                       toplevel=["Photo", "Video"],
                       options=[[["With upload", photo_choice],
                                 ["Without upload", photoNoUpload]],
                                [["with upload", video_choice],
                                 ["Without upload", videoNoUpload]]])
message = guizero.Text(app, text="Hvad skal vi lave i dag?", grid=[0, 0])
blank_message = guizero.Text(app, text="")
box0 = guizero.Box(app, layout="grid")
box0_text0 = guizero.PushButton(box0,
                                text="Tryk f for foto",
                                command=photo_choice,
                                grid=[0, 2])
box0_text1 = guizero.PushButton(box0,
                                text="Tryk v for video",
                                command=video_choice,
                                grid=[0, 3])
box0_text2 = guizero.PushButton(box0,
                                text="Tryk p for livepreview",
                                command=preview_only,
                                grid=[0, 4])
box0.show()