Example #1
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)
Example #2
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()
Example #3
0
 def __init__(self,x,y,identity_card,master,text_box,directs,option):
     self.step=guizero.PushButton(master,grid=[x,y],command=self.press,image='white.png')
     self.identity_card=identity_card
     self.text_box=text_box
     self.x=x
     self.y=y
     self.directs=directs
     self.option=option
Example #4
0
 def __init__(self, x, y, master, _imag, value, _dictionary):
     self.value = value
     self.dictionary = _dictionary
     self.button = guizero.PushButton(master,
                                      grid=[x, y],
                                      text='',
                                      image=_imag,
                                      command=self.input)
     self.button.bg = 'black'
Example #5
0
def edit_identity_cards(identity_cards,matrix,desktop):

    windows=guizero.Window(desktop,layout='grid',title='Edit',visible=False)
    road={}
    text_box=guizero.TextBox(windows,grid=[20,0],width=45,enabled=False)
    end = guizero.PushButton(windows, grid=[20, 1], text='End',command=lambda: save_(identity_cards, road, matrix, windows))
    directs=guizero.Combo(windows,options=["up", "down", "left","right"],grid=[20,2])
    option=guizero.PushButton(windows,grid=[20,4],text='Nome')

    y=14
    for i in range(15):
        for x in range(20):
            dictionary = {'X': 'black', 'o': 'green', ' ': 'white', 'v': 'yellow'}
            road[x,y]=box(x,i,identity_cards[x,y],windows,text_box,directs,option)
            road[x,y].step.bg=dictionary[matrix[x,y]]
        y-=1

    windows.show(wait=True)
Example #6
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)
Example #7
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])
Example #8
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")
Example #9
0
def visualize(matrix, steps, image, desktop, n_step):
    windows = guizero.Window(desktop,
                             layout='grid',
                             visible=False,
                             title='End')
    dictionary = {'X': 'black', 'o': 'green', ' ': 'white', 'v': 'yellow'}
    global n_steps
    n_steps = n_step
    global xd
    global yd
    y = 14
    xd, yd = location('o', matrix)
    road = {}
    for iy in range(15):
        for ix in range(20):
            road[ix, iy] = guizero.Picture(windows, image=image, grid=[ix, y])
            road[ix, iy].bg = dictionary[matrix[ix, iy]]
        y -= 1
    windows.show(wait=True)
    guizero.PushButton(
        windows,
        text='Go forward',
        grid=[(ix + 1), 0],
        command=lambda: forward(steps, road, int(len(steps)), windows))
Example #10
0
import guizero as g

def clear_uname():
    uname.clear()

def clear_pass():
    password.clear()


app = g.App(title='Login', height=300, width=500, layout='grid', bg='lightblue')
title = g.Text(app, text='SIGN IN', size=40, color='blue', font='Helvetica', grid=[1, 0], align='left')
uname_label = g.Text(app, text='Enter username: '******'left', size=15)
uname = g.TextBox(app, text='Username', grid=[1, 2], width=45, align='left')
uname.when_clicked = clear_uname
password_lbl = g.Text(app, text='Enter password: '******'left')
password = g.TextBox(app, text='Password', grid=[1, 3], width=45, align='left')
password.when_clicked = clear_pass

forgot_pass = g.Text(app, text='Forgot password?', color='blue', font='Helvetica', grid=[0, 4], align='left')

login_button = g.PushButton(app, text='Login', grid=[0, 5], align='left', width=10, height=1)
login_button.text_size = 10
register_button = g.PushButton(app, text='Signup', grid=[0, 6], align='left', width=10, height=1)

app.display()


    def __init__(self, app, ip_selection, current_config):
        self.ip_selection = ip_selection
        self.current_config = current_config

        self.window = guizero.Window(app,
                                     title="Sensors Configuration",
                                     width=625,
                                     height=385,
                                     layout="grid",
                                     visible=False)

        self.text_select = guizero.Text(
            self.window,
            text="Select Sensor IPs in the main window",
            grid=[1, 1, 3, 1],
            color='#CB0000',
            align="left")

        self.textbox_config = guizero.TextBox(
            self.window,
            text=app_variables.default_sensor_config_text.strip(),
            grid=[1, 2],
            width=75,
            height=18,
            multiline=True,
            scrollbar=True,
            align="right")

        self.button_get_config = guizero.PushButton(
            self.window,
            text="Get Sensor\nConfiguration",
            command=self.button_get,
            grid=[1, 10],
            align="left")

        self.text_select_combo = guizero.Text(
            self.window,
            text="Select Configuration File to Edit",
            grid=[1, 10],
            color='blue',
            align="top")

        self.combo_dropdown_selection = guizero.Combo(
            self.window,
            options=[
                "Configuration", "Installed Sensors", "Wifi",
                "Trigger Variances"
            ],
            grid=[1, 10],
            command=self.combo_selection,
            align="bottom")

        self.button_set_config = guizero.PushButton(
            self.window,
            text="Set Sensor\nConfiguration",
            command=self.button_set,
            grid=[1, 10],
            align="right")

        # Window Tweaks
        self.window.tk.resizable(False, False)
        self.textbox_config.bg = "black"
        self.textbox_config.text_color = "white"
        self.textbox_config.tk.config(insertbackground="red")
Example #12
0
		for i in data:
			file.write(i)
		file.close
		if deletedfiles ==[]:
			report.append('⮚ No old file deleted')
		else:
			report.append('⮚ All old files deleted')

	except:
		report.append("⮚ ERROR IN DELETING FILES")


app = gz.App(title="PizzaDeleter")
app.tk.iconbitmap('pizzicon.ico')

deletebar = gz.Box(app, width="fill", height=25)
filebutton = gz.PushButton(deletebar, text="File", align="left", height="fill", command=filebutton)
filebox = gz.TextBox(deletebar, align="left", width="fill", height="fill")
deletebutton = gz.PushButton(deletebar, text="DELETE", align="right", height="fill", command=movefolder)


report = gz.TextBox(app, text="⮚ Deleting older than 48 hours",  width="fill", height="fill", multiline=True, scrollbar=True)
deleteold()
report.append('⮚ Select a file and click on DELETE')



app.display()
zipfiler.zipper()

    def __init__(self):
        self.current_config = app_config.get_from_file()

        self.app = guizero.App(title="KootNet Sensors - Control Center",
                               width=405,
                               height=295,
                               layout="grid")

        self.app.on_close(self._app_exit)

        self.text_download_db = "Download SQL Databases"
        self.text_system_report = "Systems Report"
        self.text_configuration_report = "Configurations Report"
        self.text_test_sensors = "Sensors Test Report"

        self.ip_selection = CreateIPSelector(self.app, self.current_config)
        self._set_ip_list()

        self.window_control_center_config = CreateConfigWindow(
            self.app, self.current_config, self.ip_selection)
        self.window_sensor_display = CreateSensorDisplayWindow(
            self.app, self.ip_selection, self.current_config)
        self.window_sensor_commands = CreateSensorCommandsWindow(
            self.app, self.ip_selection, self.current_config)
        self.window_sensor_config = CreateSensorConfigWindow(
            self.app, self.ip_selection, self.current_config)
        self.window_sensor_logs = CreateSensorLogsWindow(
            self.app, self.ip_selection, self.current_config)
        self.window_graph = CreateGraphingWindow(self.app, self.ip_selection,
                                                 self.current_config)
        self.window_db_info = CreateDataBaseInfoWindow(self.app,
                                                       self.current_config)
        self.window_sensor_notes = CreateDataBaseNotesWindow(
            self.app, self.ip_selection, self.current_config, "sensor")
        self.window_db_notes = CreateDataBaseNotesWindow(
            self.app, self.ip_selection, self.current_config, "database")
        self.window_about = CreateAboutWindow(self.app)

        self.app_menubar = guizero.MenuBar(
            self.app,
            toplevel=["File", "Sensors", "Graphing & Databases", "Help"],
            options=[
                [[
                    "Control Center Configuration",
                    self.window_control_center_config.window.show
                ], ["Open Logs", self._app_menu_open_logs],
                 [
                     "Save IP List",
                     self.window_control_center_config.save_ip_list
                 ], ["Reset IP List", self._reset_ip_list],
                 ["Quit", self._app_exit]],
                [["Remote Display", self.window_sensor_display.window.show],
                 ["View & Download Logs", self.window_sensor_logs.window.show],
                 ["Online Notes Editor", self.window_sensor_notes.window.show],
                 ["Send Commands", self.window_sensor_commands.window.show],
                 [
                     "Update Configurations",
                     self.window_sensor_config.window.show
                 ]],
                [["Graphing", self.window_graph.window.show],
                 ["DataBase Info", self.window_db_info.window.show],
                 ["Offline Notes Editor", self.window_db_notes.window.show]],
                [["KootNet Sensors - About", self.window_about.window.show],
                 ["KootNet Sensors - Website", self._app_menu_open_website],
                 [
                     "Sensor Units - Making a Sensor",
                     self._app_menu_open_build_sensor
                 ], ["Sensor Units - Help", self._app_menu_open_sensor_help],
                 [
                     "Control Center - Help",
                     self._app_menu_open_control_center_help
                 ]]
            ])

        self.app_button_check_sensor = guizero.PushButton(
            self.app,
            text="Check Sensors\nStatus",
            command=self.ip_selection.get_verified_ip_list,
            grid=[1, 15, 2, 1],
            align="left")

        self.combo_dropdown_selection = guizero.Combo(
            self.app,
            options=[
                self.text_system_report, self.text_configuration_report,
                self.text_test_sensors, self.text_download_db
            ],
            command=self._app_dropdown_change,
            grid=[2, 15, 3, 1],
            align="bottom")

        self.app_button_main_create = guizero.PushButton(
            self.app,
            text="Create",
            command=self._app_button_proceed,
            grid=[4, 15],
            align="right")

        # Window Tweaks
        self.app.tk.resizable(False, False)
    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()
Example #15
0
		LEDBoardwindow.hide()
	else:
		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" )
Example #16
0
            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")


menubar = guizero.MenuBar(app,
                          toplevel=['About'],
                          options=[[['About Metas-Strip', about]]])

message = guizero.Text(app, text="")
message = guizero.Text(app, text="Metas-Strip")
message = guizero.Text(app, text="Enter image path")
message = guizero.Text(app, text="")
input_box = guizero.TextBox(app, width="70")
message = guizero.Text(app, text="")
button = guizero.PushButton(app, command=open_image, text="Open Image")
cancel = guizero.PushButton(buttons_box,
                            text="Clear",
                            align="right",
                            command=clear_all)

app.display()
Example #17
0
sys.stdout = redirect_string

app_title_name = "KootNet Sensors - Unit Tester for " + compatible_version_str
app = guizero.App(title=app_title_name, width=622, height=538, layout="grid")
app_text_address = guizero.Text(app,
                                text="Sensor Address",
                                grid=[1, 1],
                                align="left")
app_textbox_address = guizero.TextBox(app,
                                      text="localhost",
                                      width=40,
                                      grid=[2, 1],
                                      align="left")
app_button_test_sensor = guizero.PushButton(app,
                                            text="Start Tests",
                                            command=button_go,
                                            grid=[3, 1],
                                            align="right")

note_text = "Note: Use a custom port with Address:Port\nExamples: 10.0.1.1:1655 or sensor.location.com:4445"
app_note_text = guizero.Text(app,
                             text=note_text,
                             grid=[1, 2, 3, 1],
                             align="top")

app_text_user = guizero.Text(app, text="Username", grid=[1, 4], align="right")
app_textbox_user = guizero.TextBox(app,
                                   text="Kootnet",
                                   width=10,
                                   grid=[2, 4],
                                   align="left")
    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="Graphing",
                                     width=280,
                                     height=580,
                                     layout="grid",
                                     visible=False)

        self.text_sensor_type_name = guizero.Text(self.window,
                                                  text="Data Source",
                                                  color='blue',
                                                  grid=[1, 1, 2, 1],
                                                  align="top")

        self.radio_sensor_type = guizero.ButtonGroup(
            self.window,
            options=["Live Sensor", "SQL Database"],
            horizontal="True",
            command=self._radio_source_selection,
            grid=[1, 2, 2, 1],
            align="top")

        self.text_space3 = guizero.Text(self.window,
                                        text="SQL Recording Type",
                                        color="blue",
                                        grid=[1, 3, 2, 1],
                                        align="top")

        self.radio_recording_type_selection = guizero.ButtonGroup(
            self.window,
            options=["Interval", "Triggers"],
            horizontal="True",
            command=self._radio_sql_type_selection,
            grid=[1, 4, 2, 1],
            align="top")

        self.text_sensor_type_name = guizero.Text(self.window,
                                                  text="Graph Options",
                                                  color='blue',
                                                  grid=[1, 6, 2, 1],
                                                  align="top")

        self.text_space2 = guizero.Text(self.window,
                                        text="YYYY-MM-DD HH:MM:SS",
                                        size=7,
                                        color='#CB0000',
                                        grid=[2, 7, 2, 1],
                                        align="left")

        self.text_start = guizero.Text(self.window,
                                       text="Start Date & Time: ",
                                       color='green',
                                       grid=[1, 8],
                                       align="left")

        self.textbox_start = guizero.TextBox(self.window,
                                             text="",
                                             width=20,
                                             grid=[2, 8],
                                             align="left")

        self.text_end = guizero.Text(self.window,
                                     text="End Date & Time:",
                                     color='green',
                                     grid=[1, 9],
                                     align="left")

        self.textbox_end = guizero.TextBox(self.window,
                                           text="",
                                           width=20,
                                           grid=[2, 9],
                                           align="left")

        self.text_sql_skip = guizero.Text(self.window,
                                          text="Plot Data - Skip:  ",
                                          color='green',
                                          grid=[1, 10],
                                          align="right")

        self.textbox_sql_skip = guizero.TextBox(self.window,
                                                text="",
                                                width=10,
                                                grid=[2, 10],
                                                align="left")

        self.text_sql_skip2 = guizero.Text(self.window,
                                           text=" Plot 1    ",
                                           color='green',
                                           grid=[2, 10],
                                           align="right")

        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.text_refresh_time = guizero.Text(self.window,
                                              text="Live refresh (Sec):",
                                              color='green',
                                              grid=[1, 12],
                                              align="left")

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

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

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

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

        self.checkbox_env_temperature = guizero.CheckBox(
            self.window,
            text=self.readable_column_names.environmental_temp,
            command=self._disable_other_checkboxes,
            args=[self.sql_columns.environmental_temp],
            grid=[1, 19],
            align="left")

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

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

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

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

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

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

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

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

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

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

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

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

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

        self.button_live = guizero.PushButton(
            self.window,
            text="Create Graph",
            command=self._create_graph_button,
            grid=[1, 36, 2, 1],
            align="top")

        # Window Tweaks
        self.window.tk.resizable(False, False)
        self.checkbox_default_offset.value = 1
        self._set_config()
        self._radio_source_selection()
        self._click_checkbox_offset()
        self.checkbox_up_time.value = 0
        self.checkbox_env_temperature.value = 0
        self.checkbox_pressure.value = 0
        self.checkbox_humidity.value = 0
        self.checkbox_lumen.value = 0
        self.checkbox_colour.value = 0

        # Temp disable radio box until triggers working
        self.radio_recording_type_selection.disable()
Example #19
0
def main():
    guizero_app = guizero.App(
        title="Window blinds automatic opener & closer",
        width=500,
        height=700)
    vertical_spacer(guizero_app, 10)

    pin_window_blinds_direction = 12  # GPIO pin 12 == Raspberry Pi pin 32
    pin_window_blinds_pwm = 16  # GPIO pin 16 == Raspberry Pi pin 36
    window_blinds = WindowBlinds(
        guizero_app, pin_window_blinds_direction,
        pin_window_blinds_pwm)

    pin_neopixel = board.D18  # GPIO pin 18 == Raspberry Pi pin 12
    led_count = 35
    maximum_duty_cycle = 5  # limit the led brightness
    neopixel_ring_clock = NeopixelRingClock(pin_neopixel, led_count,
                                            maximum_duty_cycle)
    neopixel_ring_clock.update()

    datetime_daily_alarm_close = None
    datetime_daily_alarm_open = None
    datetime_one_time_alarm_open = None

    vertical_spacer(guizero_app, 10)
    box_brightness = guizero.Box(guizero_app, width="fill")
    box_brightness.set_border(1, "#aaaaaa")
    guizero.Text(box_brightness, text="LED brightness").tk.configure(
        font=("Liberation Sans", 12, "bold"))

    def handle_brightness_changed():
        neopixel_ring_clock.max_brightness = int(slider_brightness.value)
        neopixel_ring_clock.update()
    slider_brightness = guizero.Slider(box_brightness, start=0, end=255,
                                       command=handle_brightness_changed, width="fill")
    slider_brightness.value = maximum_duty_cycle

    vertical_spacer(guizero_app, 40)
    ########################################################################
    #################### Create GUI for daily alarm ########################
    ########################################################################
    box_daily_alarm = guizero.Box(guizero_app, width="fill")
    box_daily_alarm.set_border(1, "#aaaaaa")
    guizero.Text(box_daily_alarm, text="Daily alarm").tk.configure(
        font=("Liberation Sans", 12, "bold"))
    vertical_spacer(box_daily_alarm, 10)

    # Duration before sunrise to close the blinds
    box_close_blinds_time = guizero.Box(box_daily_alarm)
    guizero.Text(box_close_blinds_time, text="Close the blinds ", align="left")
    textbox_duration_before_sunrise = guizero.TextBox(box_close_blinds_time,
                                                      align="left", text="1 hour")
    guizero.Text(box_close_blinds_time, text=" before sunrise.",
                 align="left")

    # What time to open the blinds afterwards
    box_open_blinds_time = guizero.Box(box_daily_alarm)
    guizero.Text(
        box_open_blinds_time,
        text="Then, open the blinds at ",
        align="left")
    textbox_open_blinds_time = guizero.TextBox(box_open_blinds_time,
                                               text="11 AM", align="left")
    guizero.Text(box_open_blinds_time, text=".", align="left")

    text_daily_alarm_status = guizero.Text(box_daily_alarm,
                                           text="Click the button below to set the daily alarm.")
    vertical_spacer(box_daily_alarm, 10)
    text_daily_alarm_status2 = guizero.Text(box_daily_alarm,
                                            text="Second line of status")
    vertical_spacer(box_daily_alarm, 10)
    text_daily_alarm_status3 = guizero.Text(box_daily_alarm,
                                            text="Third line of status")

    def set_daily_alarm(for_date=None):
        # Close the blinds a user-specified amount of time before sunrise.
        # Open the blinds at a user specified absolute time.

        # Coordinates for the City of Santa Clara, California
        sun = suntime.Sun(37.354444, -121.969167)

        if for_date is None:
            # If the date to get the sunrise for isn't speficied,
            # schedule the blinds to open for the next future sunrise.
            datetime_now = datetime.now().astimezone()
            date_today = datetime_now.date()
            is_pm = datetime_now.hour > 11
            if is_pm:
                # Sunrise is always in the AM. If the current time is PM,
                # schedule the blinds to open for tomorrow's sunrise.
                date_tomorrow = date_today + timedelta(days=1)
                datetime_sunrise = sun.get_sunrise_time(
                    date_tomorrow).astimezone()

            else:
                # Check if sunrise already happened
                datetime_sunrise_today = sun.get_sunrise_time(
                    date_today).astimezone()

                if datetime_sunrise_today <= datetime_now:
                    # Sunrise already happened today. Schedule the blinds
                    # to open for tomorrow's sunrise.
                    date_tomorrow = date_today + timedelta(days=1)
                    datetime_sunrise = sun.get_sunrise_time(
                        date_tomorrow).astimezone()
                else:
                    # sunrise is in the future today
                    datetime_sunrise = datetime_sunrise_today

        else:
            # Use the date given in the keywork argument.
            datetime_sunrise = sun.get_sunrise_time(for_date).astimezone()

        nonlocal datetime_daily_alarm_close

        seconds_before_sunrise = Duration(
            textbox_duration_before_sunrise.value).to_seconds()
        datetime_daily_alarm_close = (datetime_sunrise -
                                      timedelta(seconds=seconds_before_sunrise)).astimezone()

        # When to open the blinds - get an absolute time from user.
        datetime_parsed_open_at = dateparser.parse(
            textbox_open_blinds_time.value).astimezone()

        nonlocal datetime_daily_alarm_open

        if datetime_parsed_open_at is None:
            text_daily_alarm_status.text_color = "red"
            text_daily_alarm_status.value = "Couldn't parse date from string"
            datetime_daily_alarm_open = None
            return

        datetime_daily_alarm_open = datetime.combine(datetime_sunrise.date(),
                                                     datetime_parsed_open_at.time()).astimezone()

        if datetime_daily_alarm_open <= datetime_daily_alarm_close:
            text_daily_alarm_status.text_color = "red"
            text_daily_alarm_status.value = \
                "Trying to set blinds to open before they close:" + \
                "\ndatetime_daily_alarm_open = " + \
                datetime_daily_alarm_open.strftime(DATETIME_FORMAT_STRING) + \
                "\ndatetime_daily_alarm_close = " + \
                datetime_daily_alarm_close.strftime(DATETIME_FORMAT_STRING)
            datetime_daily_alarm_open = None
            return

        neopixel_ring_clock.put_alarm_region("daily",
                                             datetime_daily_alarm_close, datetime_daily_alarm_open)

        text_daily_alarm_status.text_color = "black"
        text_daily_alarm_status.value = \
            "\nSunrise is:\n" + \
            datetime_sunrise.strftime(DATETIME_FORMAT_STRING) + \
            "\n\nClose blinds at:\n" + \
            datetime_daily_alarm_close.strftime(DATETIME_FORMAT_STRING) + \
            "\n\nThen open blinds at:\n" + \
            datetime_daily_alarm_open.strftime(DATETIME_FORMAT_STRING)

    guizero.PushButton(box_daily_alarm, text="Update daily alarm",
                       command=set_daily_alarm)

    vertical_spacer(guizero_app, 40)

    #################################################################
    ################## Create gui for a one-time alarm ##############
    #################################################################
    box_one_time_alarm = guizero.Box(guizero_app, width="fill")
    box_one_time_alarm.set_border(1, "#aaaaaa")
    guizero.Text(box_one_time_alarm,
                 text="One-time alarm").tk.configure(font=("Liberation Sans", 12, "bold"))
    vertical_spacer(box_one_time_alarm, 10)

    box_one_time_alarm_time = guizero.Box(box_one_time_alarm)
    guizero.Text(box_one_time_alarm_time,
                 text="Close blinds now, then open blinds ", align="left")
    textbox_one_time_alarm = guizero.TextBox(box_one_time_alarm_time,
                                             text="in 20 seconds", align="left", width=20)
    guizero.Text(box_one_time_alarm_time, text=".", align="left")

    text_one_time_alarm_status = guizero.Text(box_one_time_alarm,
                                              text="Click the button below to set a one-time alarm.")

    def set_one_time_alarm():
        datetime_parsed = dateparser.parse(textbox_one_time_alarm.value) \
            .astimezone()
        datetime_now = datetime.now().astimezone()
        nonlocal datetime_one_time_alarm_open

        if datetime_parsed is None:
            text_one_time_alarm_status.text_color = "red"
            text_one_time_alarm_status.value = \
                "Couldn't parse date from string"
            datetime_one_time_alarm_open = None
            return

        total_seconds = (datetime_parsed - datetime_now).total_seconds()
        if total_seconds < 1:
            text_one_time_alarm_status.text_color = "red"
            text_one_time_alarm_status.value = \
                "Can't set alarm to ring in the past"
            datetime_one_time_alarm_open = None
            return

        if total_seconds >= 60 * 60 * 24:
            text_one_time_alarm_status.text_color = "red"
            text_one_time_alarm_status.value = "Setting alarm to ring " + \
                "more than one day in the future is not supported"
            datetime_one_time_alarm_open = None
            return

        datetime_one_time_alarm_open = datetime_parsed

        # Starts the blinds closing, returns immediately, does not block.
        window_blinds.go_to_closed()

        neopixel_ring_clock.put_alarm_region("one-time", datetime_now,
                                             datetime_one_time_alarm_open)
        text_one_time_alarm_status.text_color = "black"
        text_one_time_alarm_status.value = "Submitted"

    guizero.PushButton(box_one_time_alarm, text="Set one-time alarm",
                       command=set_one_time_alarm)

    def tick():
        datetime_now = datetime.now().astimezone()

        nonlocal datetime_one_time_alarm_open
        nonlocal datetime_daily_alarm_close
        nonlocal datetime_daily_alarm_open

        if datetime_daily_alarm_close is not None:
            timedelta_to_daily_alarm_close = \
                datetime_daily_alarm_close - datetime_now
            total_seconds = timedelta_to_daily_alarm_close.total_seconds()
            #print(f"total_seconds until daily alarm close: {total_seconds}")
            if total_seconds > 0:
                hours, minutes, seconds = \
                    timedelta_split(timedelta_to_daily_alarm_close)
                text_daily_alarm_status2.value = \
                    f"Blinds will close in {hours} hr {minutes} min {seconds} sec"
            else:
                #print("which is leq zero, so I am closing the blinds")
                text_daily_alarm_status2.value = \
                    f"Blinds closed at\n{datetime_now.strftime(DATETIME_FORMAT_STRING)}."
                datetime_daily_alarm_close = None
                window_blinds.go_to_closed()

        if datetime_daily_alarm_open is not None:
            timedelta_to_daily_alarm_open = \
                datetime_daily_alarm_open - datetime_now
            total_seconds = timedelta_to_daily_alarm_open.total_seconds()
            #print(f"total_seconds until daily alarm open:  {total_seconds}")
            if total_seconds > 0:
                hours, minutes, seconds = \
                    timedelta_split(timedelta_to_daily_alarm_open)
                text_daily_alarm_status3.value = \
                    f"Blinds will open in {hours} hr {minutes} min {seconds} sec"
            else:
                #print("    which is leq zero, so I am opening the blinds")
                text_daily_alarm_status3.value = \
                    f"Blinds opened at\n{datetime_now.strftime(DATETIME_FORMAT_STRING)}."
                datetime_daily_alarm_open = None
                window_blinds.go_to_open()
                date_tomorrow = date.today() + timedelta(days=1)
                set_daily_alarm(date_tomorrow)

        if datetime_one_time_alarm_open is not None:
            timedelta_to_one_time_alarm_open = \
                datetime_one_time_alarm_open - datetime_now
            total_seconds = timedelta_to_one_time_alarm_open.total_seconds()
            if total_seconds > 0:
                hours, minutes, seconds = \
                    timedelta_split(timedelta_to_one_time_alarm_open)
                text_one_time_alarm_status.value = f"One-time alarm will ring in {hours} hr {minutes} min {seconds} sec"
            else:
                text_one_time_alarm_status.value = f"One-time alarm rang at\n{datetime_now.strftime(DATETIME_FORMAT_STRING)}."
                datetime_one_time_alarm_open = None
                neopixel_ring_clock.remove_alarm_region("one-time")
                window_blinds.go_to_open()

        neopixel_ring_clock.update()

    set_daily_alarm()
    guizero_app.repeat(1000, tick)
    guizero_app.display()  # blocks until the guizero window is closed
    window_blinds.stop()
    neopixel_ring_clock.all_off()
Example #20
0
              radioCommands[radioSelection.value]["byteSize"],
              radioCommands[radioSelection.value]["TX"],
              radioCommands[radioSelection.value]["RX"]))
    StartTxButton.disable()
    EndTxButton.enable()
    killComFlagFalse = False
    TxRxLoopThread.run()


def stopCom():

    global killComFlag

    StartTxButton.enable()
    EndTxButton.disable()
    killComFlag = True


StartTxButton = guizero.PushButton(root,
                                   text="Enable TX",
                                   command=startCom,
                                   grid=[0, 4])
EndTxButton = guizero.PushButton(root,
                                 text="Disable TX",
                                 command=stopCom,
                                 grid=[1, 4])
EndTxButton.disable()

root.repeat(100, updateTick)
root.repeat(25, maintainWindowSize)
root.display()
Example #21
0
def imgValue(valor):
    global imagem, img_window
    imagem = valor
    img_window.value = "./assets/" + valor
    img_window.height = 56
    img_window.width = 56
    print(valor)


listbox = gui.ListBox(app, items=getCursives(), scrollbar=True, command=imgValue, align="center")

listbox.bg = "#ffffff"
listbox.text_color = "#000000"


def trigger_reconhecimento():
    global imagem, img_window
    if imagem == 0:
        gui.warn('Erro', 'Selecione uma imagem')
        return False
    else:
        gui.info('Resultado', rcgTrigger.execute(imagem="./assets/" + imagem))


btn = gui.PushButton(app, text="Reconhecer imagem", command=trigger_reconhecimento)

app.display()



Example #22
0
                            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)
    guizero.info("Booking", "Thank you for booking")


book_seats = guizero.PushButton(app,
                                command=do_booking,
                                text="Book Seat",
                                grid=[1, 3],
                                align="left")

app.display()
Example #23
0
    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()
box1 = guizero.Box(app, layout="grid")
box1.hide()
text1 = guizero.Text(box1,
                     text="Hvor mange minutter skal der optages? ",
                     grid=[0, 0])
Example #24
0
matrix = {}
dictionary = {'X': 'black', 'o': 'green', ' ': 'white', 'v': 'yellow'}

# GUI -->
desktop = guizero.App(
    title='Start',
    layout='grid',
    visible=False,
)
picture = 'white.png'

# BUTTON
color = guizero.Text(desktop, grid=[20, 0], text='Wall')
wall = guizero.PushButton(desktop,
                          grid=[20, 1],
                          command=lambda: command('X', color),
                          text='')
road = guizero.PushButton(desktop,
                          grid=[20, 2],
                          command=lambda: command(' ', color),
                          text='')
start = guizero.PushButton(desktop,
                           grid=[20, 3],
                           command=lambda: command('o', color),
                           text='')
goal = guizero.PushButton(desktop,
                          grid=[20, 4],
                          command=lambda: command('v', color),
                          text='')
end = guizero.PushButton(desktop,
                         text='analyze',
    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
Example #26
0
  Run = False
  stop.disable()
  start.enable()

# most important function
def Ukonci_meranie():
  exit()

# collect data pack it and send it away
def Read_Send():
  if Run:
    msg = "cpu:"+str(int(psutil.cpu_percent()))
    UDPClientSocket.sendto(msg.encode(), serverAddressPort)

# let's build the gui
aplikacia = guizero.App(title="Meranie CPU na dialku")
okienko = guizero.Box(aplikacia, layout = "grid")
start = guizero.PushButton(okienko, command=Start_meranie, text = "Start", grid = [0,0])
stop = guizero.PushButton(okienko, command=Stop_meranie, text = "Stop", grid = [1,0])
koniec = guizero.PushButton(okienko, command=Ukonci_meranie, text = "Koniec", grid = [2,0])
stop.disable()

# main loop
try:
  UDPClientSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
  aplikacia.repeat(400, Read_Send)
  aplikacia.display()
      
except KeyboardInterrupt:
 pass
Example #27
0
    #    t += volumen*pump_ml_to_s
    #print(ingredients)
    
    
=======

    #    print('for ' + (volumen*pump_ml_to_s)-t + ' sec')
    #    t += volumen*pump_ml_to_s
    #print(ingredients)

>>>>>>> e1856f4529bc40e669bdbe2a7f00bc1255faaf09



drinks = MyDrinks.FinalDrinksList()
#print(drinks)

drinknames = [drinkid[1] for drinkid in drinks]

<<<<<<< HEAD
app = guizero.App(title="BartenderTron 3000")
=======
app = guizero.App(title="Bartendertron3000")
>>>>>>> e1856f4529bc40e669bdbe2a7f00bc1255faaf09

drink_choice = guizero.Combo(app, options=drinknames, grid=[1,0], align="left")

choice_drink = guizero.PushButton(app, command=PressDrinkButton, text="Pour drink", grid=[1,3], align="left")

app.display()
Example #28
0
def switchWormholeAurora():
    wormholeAuroraImage.image = "images/a{}.bmp".format(
        wormholeAuroraSlider.value)


wormholeAuroraSlider = guizero.Slider(mainApp,
                                      start=1,
                                      end=4,
                                      horizontal=True,
                                      command=switchWormholeAurora,
                                      grid=[0, 4])


def results():

    whDestination = wormholeEyeLocations[wormholeEyeSlider.value]
    whMassLimit = wormholeAuroraMeanings[wormholeAuroraSlider.value]

    guizero.info(
        "Type of wormhole: ",
        f"This wormhole leads to:\n{whDestination}\n\nThis wormhole can transport:\n{whMassLimit}",
        master=mainApp)


submitButton = guizero.PushButton(mainApp,
                                  command=results,
                                  text="Submit",
                                  grid=[0, 5])

mainApp.display()
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()
Example #30
0
    def __init__(self, app, current_config):
        self.current_config = current_config
        self.database_line_width = 40
        self.textbox_table_width = 22

        self.window = guizero.Window(app,
                                     title="DataBase Information",
                                     width=595,
                                     height=635,
                                     layout="grid",
                                     visible=False)

        self.button_open_database = guizero.PushButton(
            self.window,
            text="Open\nDatabase",
            command=self._open_database,
            grid=[1, 1, 1, 2],
            align="left")

        self.text_database_label = guizero.Text(self.window,
                                                text="Database: ",
                                                color='blue',
                                                grid=[1, 1],
                                                align="right")

        self.textbox_database_name = guizero.TextBox(
            self.window,
            text="Please Open a Database",
            width=self.database_line_width,
            grid=[2, 1, 2, 1],
            align="left")

        self.text_database_location_label = guizero.Text(self.window,
                                                         text="Location: ",
                                                         color='blue',
                                                         grid=[1, 2],
                                                         align="right")

        self.textbox_database_location = guizero.TextBox(
            self.window,
            text="Please Open a Database",
            width=self.database_line_width,
            height=2,
            grid=[2, 2, 2, 1],
            multiline=True,
            scrollbar=True,
            align="left")

        self.text_db_dates = guizero.Text(self.window,
                                          text="Date Range: ",
                                          color='blue',
                                          grid=[1, 3],
                                          align="right")

        self.textbox_db_dates = guizero.TextBox(
            self.window,
            text="First Recorded Date || Last Recorded Date",
            width=self.database_line_width,
            grid=[2, 3, 2, 1],
            align="left")

        self.text_db_size = guizero.Text(self.window,
                                         text="Database Misc. Info: ",
                                         color='blue',
                                         grid=[1, 4],
                                         align="right")

        self.textbox_misc_db_info = guizero.TextBox(
            self.window,
            text="DB Size:  MB || Notes: XX || Reboots: XX",
            width=self.database_line_width,
            grid=[2, 4, 2, 1],
            align="left")

        self.text_name_changes = guizero.Text(
            self.window,
            text="\nRecorded Name Changes\nCurrent: ",
            color='purple',
            grid=[2, 7, 2, 1],
            align="left")

        self.text_name_date = guizero.Text(self.window,
                                           text="Date of Change",
                                           color='blue',
                                           grid=[1, 10],
                                           align="left")

        self.textbox_name_dates = guizero.TextBox(
            self.window,
            text="1. Date",
            width=self.textbox_table_width,
            height=10,
            grid=[1, 11],
            multiline=True,
            scrollbar=True,
            align="left")

        self.text_name_new = guizero.Text(self.window,
                                          text="New Name",
                                          color='blue',
                                          grid=[2, 10],
                                          align="left")

        self.textbox_new_names = guizero.TextBox(
            self.window,
            text="1. NewName",
            width=self.textbox_table_width,
            height=10,
            grid=[2, 11],
            multiline=True,
            scrollbar=True,
            align="left")

        self.text_name_old = guizero.Text(self.window,
                                          text="Old Name",
                                          color='blue',
                                          grid=[3, 10],
                                          align="left")

        self.textbox_old_names = guizero.TextBox(
            self.window,
            text="1. OldName",
            width=self.textbox_table_width,
            height=10,
            grid=[3, 11],
            multiline=True,
            scrollbar=True,
            align="left")

        self.text_ip_changes = guizero.Text(
            self.window,
            text="\nRecorded IP Changes\nCurrent: ",
            color='purple',
            grid=[2, 12],
            align="left")

        self.text_ip_date = guizero.Text(self.window,
                                         text="Date of Change",
                                         color='blue',
                                         grid=[1, 16],
                                         align="left")

        self.textbox_ip_dates = guizero.TextBox(self.window,
                                                text="1. Date",
                                                width=self.textbox_table_width,
                                                height=10,
                                                grid=[1, 17],
                                                multiline=True,
                                                scrollbar=True,
                                                align="left")

        self.text_ip_new = guizero.Text(self.window,
                                        text="New IP",
                                        color='blue',
                                        grid=[2, 16],
                                        align="left")

        self.textbox_new_ips = guizero.TextBox(self.window,
                                               text="1. NewIP",
                                               width=self.textbox_table_width,
                                               height=10,
                                               grid=[2, 17],
                                               multiline=True,
                                               scrollbar=True,
                                               align="left")

        self.text_ip_old = guizero.Text(self.window,
                                        text="Old IP",
                                        color='blue',
                                        grid=[3, 16],
                                        align="left")

        self.textbox_old_ips = guizero.TextBox(self.window,
                                               text="1. OldIP",
                                               width=self.textbox_table_width,
                                               height=10,
                                               grid=[3, 17],
                                               multiline=True,
                                               scrollbar=True,
                                               align="left")

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

        # Window Tweaks
        self.window.tk.resizable(False, False)
        self.textbox_database_name.disable()
        self.textbox_database_location.disable()
        self.textbox_db_dates.disable()
        self.textbox_misc_db_info.disable()

        self.textbox_name_dates.bg = "black"
        self.textbox_name_dates.text_color = "white"
        self.textbox_name_dates.tk.config(insertbackground="red")

        self.textbox_new_names.bg = "black"
        self.textbox_new_names.text_color = "white"
        self.textbox_new_names.tk.config(insertbackground="red")

        self.textbox_old_names.bg = "black"
        self.textbox_old_names.text_color = "white"
        self.textbox_old_names.tk.config(insertbackground="red")

        self.textbox_ip_dates.bg = "black"
        self.textbox_ip_dates.text_color = "white"
        self.textbox_ip_dates.tk.config(insertbackground="red")

        self.textbox_new_ips.bg = "black"
        self.textbox_new_ips.text_color = "white"
        self.textbox_new_ips.tk.config(insertbackground="red")

        self.textbox_old_ips.bg = "black"
        self.textbox_old_ips.text_color = "white"
        self.textbox_old_ips.tk.config(insertbackground="red")