def threaded_function2():
    global app
    app = App(title="MSHD - Metereologic Sense Hat Device", height= 900, width = 1440)
    global welcome_message

    welcome_message = Text(app, text="Know the weather", size=25, font="Times New Roman", color="blue")

    text_size = Slider(app, command=change_text_size, start=30, end=100)

    weather = Picture(app, image="screen.gif")

    global weather_options
    weather_options = Combo(app, options=["Air pressure", "Ambient Temperature", "Ground Temperature", "Humidity", "Rainfall", "Room Temperature", "Wind Speed"], grid=[0,1], align="left") 

    Run_app = PushButton(app, show_weather, text="select", grid=[3,1], align="left")
    app.display()
Пример #2
0
def abrir_jan():
    app.destroy()
    neve()
    for i in range(n):
        global app2
        app2 = App(title="Criar evento", width=380, height=260, layout="grid")
        #Nome
        global optnome
        lbnome = Text(app2, text="Nome", grid=[0,0], align="left")
        optnome = TextBox(app2, grid=[0,1], align="left")

        #Data
        global optdia, optmes, optano
        lbdia = Text(app2, text="Dia", grid=[1,0], align="left")
        optdia = TextBox(app2, grid=[2,0], align="left")
        lbmes = Text(app2, text="Mes", grid=[1,1], align="left")
        optmes = TextBox(app2, grid=[2,1], align="left")
        lbano = Text(app2, text="Ano", grid=[1,2], align="left")
        optano = TextBox(app2, grid=[2,2], align="left")

        #Hora
        global opthora, optmindec, optminuni, optampm
        lbhora = Text(app2, text="Hora", grid=[3,0], align="left")
        opthora = Combo(app2, options=["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"], grid=[4,0], align="left")
        lbminuto = Text(app2, text="Minuto", grid=[3,1], align="left")
        optmindec = Combo(app2, options=["0", "1", "2", "3", "4", "5"], grid=[4,1], align="left") 
        optminuni = Combo(app2, options=["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], grid=[4,2], align="left")
        lbampm = Text(app2, text="AM/PM", grid=[3,3], align="left")
        optampm = Combo(app2, options=["am", "pm"], grid=[4,3], align="left")

        #Lembrete
        lbnome = Text(app2, text="--Lembrete--", grid=[5,0], align="left")

        #HoraLembrete
        global opthora2, optmindec2, optminuni2, optampm2
        lbhora = Text(app2, text="Hora", grid=[6,0], align="left")
        opthora2 = Combo(app2, options=["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"], grid=[7,0], align="left")
        lbminuto = Text(app2, text="Minuto", grid=[6,1], align="left")
        optmindec2 = Combo(app2, options=["0", "1", "2", "3", "4", "5"], grid=[7,1], align="left") 
        optminuni2 = Combo(app2, options=["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], grid=[7,2], align="left")
        lbampm = Text(app2, text="AM/PM", grid=[6,3], align="left")
        optampm2 = Combo(app2, options=["am", "pm"], grid=[7,3], align="left")

        #Botao
        btsub = PushButton(app2, command=submeter, text="Submeter", grid=[8,0], align="left")

        app2.display()
Пример #3
0
from guizero import App, Text, PushButton, Slider, Picture, ButtonGroup
from gpiozero import LED

red = LED(12)
app = App()

label = Text(app, "Red")
onButton = PushButton(app, command=red.on, text="on")
offButton = PushButton(app, command=red.off, text="off")
blinkButton = PushButton(app, command=red.blink, text="blink")


def slider_changed(slider_value):
    red.blink(int(slider_value), int(slider_value))


speedSlider = Slider(app, command=slider_changed, start=0.5, end=5)


def speed_changed():
    if speedButton.value_text == 'slow':
        red.blink(1, 1)
    if speedButton.value_text == 'medium':
        red.blink(.3, .3)
    if speedButton.value_text == 'fast':
        red.blink(.1, .1)


speedButton = ButtonGroup(app,
                          command=speed_changed,
                          options=['slow', 'medium', 'fast'])
Пример #4
0
    #Locate every file in the current directory that ends in mp4
    for file in os.listdir("."):
        if file.endswith("mp4"):
            getFirstFrame(file)
            print(file)

    x = 50
    y = 75
    for  t in thumbnails:
        print(t)
        picture = PushButton(window, image=t, grid=[x,y], width=50, height=50,command=playVideo(t))
        message = Text(window, t, grid=[x+100, y])

    y = y + 50


app = App("Vivecam", 800, 480, layout="grid")
new_pic = PushButton(app, new_picture, text="New picture",  grid=[0,10])
record = PushButton(app, record, text="Record",  grid=[1, 10])
stop = PushButton(app, stop, text="Stop", grid=[2, 10])
media  = stop = PushButton(app, media, text="Media", grid=[3, 10])

app.display()





    
Пример #5
0
from guizero import App, Text, TextBox, Slider, PushButton, Combo, Picture, CheckBox, ButtonGroup, info


def do_booking():
    info("Soda Sims", "Thank you for ordering using soda sims")


def change_text_size(slider_value):
    welcome_message.font_size(slider_value)


def say_my_name():
    welcome_message.set(my_name.get())


app = App("Soda Sims")
welcome_message = Text(app,
                       text="PLEASE TYPE YOUR NAME BELOW",
                       size=15,
                       font="Times New Roman",
                       color="lightblue")
my_name = TextBox(app)
update_text = PushButton(app, command=say_my_name, text="Display my name")

text_size = Slider(app, command=change_text_size, start=10, end=80)

order_soda = Text(app,
                  text="ORDER SODA BELOW",
                  size=20,
                  font="Times New Roman",
                  color="lightblue")
Пример #6
0
class Gui(object):
    def __init__(self):

        self.dispenser = TestDispenser()
        self.cup_number = 0
        self.half_cup_number = 0
        self.eighth_cup_number = 0
        self.teaspoon_number = 0
        self.dispensing_id = Ingredient.SALT  # Default: id is salt (0)
        self.dispensing_id_text = SALT_DISPENSING_TEXT  # Default: salt
        self.dispensing_amount = 0
        self.dispensing_flag = False

        self.app = App(title="Pestle Co.")
        # All code must be added in th event loop
        # START
        # Set up the option window and hide it for now
        self.option_window = Window(self.app, title="Choosing a spice")
        self.option_window.hide()  # hide this window for now
        # Set up the dispensing window and hide it for now
        self.dispensing_window = Window(self.option_window, title="Dispensing")
        self.dispensing_window.hide()  # hide this window for now
        # Set up the welcome window
        #self.app.set_full_screen()
        self.welcome_message = Text(self.app,
                                    text="Pestle Co.",
                                    size=70,
                                    font="Times New Roman",
                                    color="blue")
        self.start_button = PushButton(self.app,
                                       command=self.open_option_window,
                                       text="Push to Start",
                                       width=20,
                                       height=5)
        self.start_button.text_color = (205, 133, 0)
        self.start_button.text_size = 30

        # Option page/window set up
        # Salt button
        self.salt_button = PushButton(self.option_window,
                                      command=self.open_salt_dispensing_window,
                                      text="Salt",
                                      align="top",
                                      width=10,
                                      height=2)
        self.salt_button.text_color = (205, 133, 0)
        self.salt_button.text_size = 20
        # Flour button
        self.flour_button = PushButton(
            self.option_window,
            command=self.open_flour_dispensing_window,
            text="Flour",
            align="top",
            width=10,
            height=2)
        self.flour_button.text_color = (205, 133, 0)
        self.flour_button.text_size = 20
        # Sugar button
        self.sugar_button = PushButton(
            self.option_window,
            command=self.open_sugar_dispensing_window,
            text="Sugar",
            align="top",
            width=10,
            height=2)
        self.sugar_button.text_color = (205, 133, 0)
        self.sugar_button.text_size = 20
        # Done button
        self.done_button = PushButton(self.option_window,
                                      command=self.close_option_window,
                                      text="Done",
                                      align="bottom",
                                      width=10,
                                      height=2)
        self.done_button.text_color = (205, 133, 0)
        self.done_button.text_size = 20

        # Dispensing page/window set up
        self.dispensing_text = Text(self.dispensing_window,
                                    text=self.dispensing_id_text)
        self.cup_button = PushButton(self.dispensing_window,
                                     command=self.add_a_cup,
                                     text="Cup")
        self.cup_number_text = Text(self.dispensing_window,
                                    text=str(self.cup_number) + " Cups(s)")
        self.cup_button.text_color = (205, 133, 0)
        self.cup_button.text_size = 20

        self.half_cup_button = PushButton(self.dispensing_window,
                                          command=self.add_a_half_cup,
                                          text="Half Cup")
        self.half_cup_number_text = Text(self.dispensing_window,
                                         text=str(self.half_cup_number) +
                                         " Half_cup(es)")
        self.half_cup_button.text_color = (205, 133, 0)
        self.half_cup_button.text_size = 20

        self.eighth_cup_button = PushButton(self.dispensing_window,
                                            command=self.add_a_eighth_cup,
                                            text="Eighth_cup")
        self.eighth_cup_number_text = Text(self.dispensing_window,
                                           text=str(self.eighth_cup_number) +
                                           " Eighth_cup(es)")
        self.eighth_cup_button.text_color = (205, 133, 0)
        self.eighth_cup_button.text_size = 20

        self.teaspoon_button = PushButton(self.dispensing_window,
                                          command=self.add_a_teaspoon,
                                          text="Teaspoon")
        self.teaspoon_number_text = Text(self.dispensing_window,
                                         text=str(self.teaspoon_number) +
                                         " Teaspoon(s)")
        self.teaspoon_button.text_color = (205, 133, 0)
        self.teaspoon_button.text_size = 20

        self.dispense_button = PushButton(self.dispensing_window,
                                          command=self.final_dispense,
                                          text="Dispense",
                                          align="bottom")
        self.reset_button = PushButton(self.dispensing_window,
                                       command=self.reset_measurement,
                                       text="Reset",
                                       align="bottom")
        # STOP
        print("here")
        self.app.display()

        # Helper functions: windows
    def open_option_window(self):
        self.option_window.show(wait=True)
        #self.option_window.set_full_screen()

    def close_option_window(self):
        self.option_window.exit_full_screen()
        self.option_window.hide()
        self.app.display()

    def open_dispensing_window(self):
        self.dispensing_window.show(wait=True)
        #self.dispensing_window.set_full_screen()

    def close_dispensing_window(self):
        self.dispensing_window.exit_full_screen()
        self.dispensing_window.hide()
        self.open_option_window()

    def open_salt_dispensing_window(self):
        self.dispensing_id_text = SALT_DISPENSING_TEXT
        self.dispensing_text.clear()
        self.dispensing_text.append(self.dispensing_id_text)
        self.dispensing_id = Ingredient.SALT
        self.open_dispensing_window()

    def open_flour_dispensing_window(self):
        self.dispensing_id_text = FLOUR_DISPENSING_TEXT
        self.dispensing_text.clear()
        self.dispensing_text.append(self.dispensing_id_text)
        self.dispensing_id = Ingredient.FLOUR
        self.open_dispensing_window()

    def open_sugar_dispensing_window(self):
        self.dispensing_id_text = SUGAR_DISPENSING_TEXT
        self.dispensing_text.clear()
        self.dispensing_text.append(self.dispensing_id_text)
        self.dispensing_id = Ingredient.SUGAR
        self.open_dispensing_window()

    def add_dispensing_amount(self, dispensing_id, unit):
        grams_per_cup = GRAMS_SALT_PER_CUP  # default
        conversion_per_cup = CUPS_PER_CUP  # default
        if dispensing_id == Ingredient.SALT:
            grams_per_cup = GRAMS_SALT_PER_CUP
        elif dispensing_id == Ingredient.FLOUR:
            grams_per_cup = GRAMS_FLOUR_PER_CUP
        elif dispensing_id == Ingredient.SUGAR:
            grams_per_cup = GRAMS_SUGAR_PER_CUP
        if unit == Unit.CUP:
            conversion_per_cup = CUPS_PER_CUP
        elif unit == Unit.HALF_CUP:
            conversion_per_cup = HALF_CUPS_PER_CUP
        elif unit == Unit.FOURTH_CUP:
            conversion_per_cup = FOURTH_CUPS_PER_CUP
        elif unit == Unit.EIGHTH_CUPS:
            conversion_per_cup = EIGHTH_CUPS_PER_CUP
        elif unit == Unit.TEASPOON:
            conversion_per_cup = TEASPOON_PER_CUP
        self.dispensing_amount += grams_per_cup / conversion_per_cup

    # Helper functions: dispensing
    def add_a_cup(self):
        self.cup_number += 1
        self.cup_number_text.clear()
        self.cup_number_text.append(str(self.cup_number) + " Cup(s)")
        self.add_dispensing_amount(self.dispensing_id, Unit.CUP)

    def add_a_half_cup(self):
        self.half_cup_number += 1
        self.half_cup_number_text.clear()
        self.half_cup_number_text.append(
            str(self.half_cup_number) + " Half Cup(s)")
        self.add_dispensing_amount(self.dispensing_id, Unit.HALF_CUP)

    def add_a_eighth_cup(self):
        self.eighth_cup_number += 1
        self.eighth_cup_number_text.clear()
        self.eighth_cup_number_text.append(
            str(self.eighth_cup_number) + " Eighth Cup(s)")
        self.add_dispensing_amount(self.dispensing_id, Unit.EIGHTH_CUPS)

    def add_a_teaspoon(self):
        self.teaspoon_number += 1
        self.teaspoon_number_text.clear()
        self.teaspoon_number_text.append(
            str(self.teaspoon_number) + " Teaspoon(s)")
        self.add_dispensing_amount(self.dispensing_id, Unit.TEASPOON)

    def ready_to_dispense(self):
        return self.dispensing_flag

    def get_slot_id(self):
        print(self.dispensing_id)

        if (self.dispensing_id == Ingredient.SALT):
            return 0
        if (self.dispensing_id == Ingredient.FLOUR):
            return 1
        if (self.dispensing_id == Ingredient.SUGAR):
            return 2
        #return 0

    def get_amount_in_grams(self):
        return self.dispensing_amount

    def reset_measurement(self):
        self.dispensing_amount = 0
        self.cup_number = 0
        self.cup_number_text.clear()
        self.cup_number_text.append(str(self.cup_number) + " Cup(s)")
        self.half_cup_number = 0
        self.half_cup_number_text.clear()
        self.half_cup_number_text.append(
            str(self.half_cup_number) + " Half Cup(s)")
        self.eighth_cup_number = 0
        self.eighth_cup_number_text.clear()
        self.eighth_cup_number_text.append(
            str(self.eighth_cup_number) + " Eighth Cup(s)")
        self.teaspoon_number = 0
        self.teaspoon_number_text.clear()
        self.teaspoon_number_text.append(
            str(self.teaspoon_number) + " Teaspoon(s)")

    def final_dispense(self):
        print("in final")
        self.dispensing_flag = True
        self.dispenser.dispense(self.get_slot_id(), self.dispensing_amount)
        self.reset_measurement()
        self.close_dispensing_window()  # Return to the dispensing window
        self.open_option_window()  # Return to the option window
# Capture Image (Take Photo)
def image_capture():
    camera.resolution = photo
    date = datetime.datetime.now().strftime('%d-%m-%Y_%H.%M.%S')
    camera.capture('/home/pi/Pictures/image_' + date + '.jpg')


# Exit Program
def exit_program():
    quit()


# GUI Setings
app = App(bg="lightgrey",
          title="Raspberry Pi Camera V1.5",
          width=850,
          height=270,
          layout="grid")

pad_txt = Text(app, text="      ", grid=[0, 0], align="left")

options_txt = Text(app,
                   text=" Options ",
                   color="blue",
                   grid=[0, 1],
                   align="left")

pic_capture = PushButton(app,
                         command=image_capture,
                         text="Take Photo",
                         width=10,
Пример #8
0
                pump_off(pumps_ports['firany'])
                pump_3_button_status.text = "Off"
                pump_3_button_status.text_color = "red"
        else:
            pump_1_button_status.text = "Off"
            pump_off(pumps_ports['dom'])
            pump_1_button_status.text_color = "red"
            pump_2_button_status.text = "Off"
            pump_off(pumps_ports['haft'])
            pump_2_button_status.text_color = "red"
            pump_3_button_status.text = "Off"
            pump_off(pumps_ports['firany'])
            pump_3_button_status.text_color = "red"


app = App(title="Sterownie Kotłowni", width="1000", height="500")

window_edit_hour = Window(app,
                          title="Edycja",
                          height=100,
                          width=450,
                          layout="grid")
Text(window_edit_hour, text="Nr. dnia", width="6", grid=[0, 0])
Text(window_edit_hour, text="Nr. rzędu", width="6", grid=[1, 0])
Text(window_edit_hour, text="Start", width="4", grid=[2, 0])
Text(window_edit_hour, text="", width="4", grid=[3, 0])
Text(window_edit_hour, text="Stop", width="4", grid=[4, 0])
save_day = TextBox(window_edit_hour, width="6", align="left", grid=[0, 1])
save_day_row_number = TextBox(window_edit_hour,
                              width="6",
                              align="left",
Пример #9
0
    print("New File is", vectorfilename.value)


###########
# GUI Stuff
###########

sig1onbtn = button(0, '1_ON', [0, 0])
sig1offbtn = button(1, '1_OFF', [0, 1])
sig2onbtn = button(2, '2_ON', [0, 2])
sig2offbtn = button(3, '2_OFF', [0, 3])
changetbbtn = button(4, 'CH_TB', [0, 4])
exitbtn = button(5, 'EXIT', [1, 5])

app = App(title="Machine Signal Simulator",
          width=350,
          height=350,
          layout="grid")

sig1onbtn = PushButton(app,
                       command=Flasher1On,
                       text="CH1 ON",
                       grid=sig1onbtn.grid)
sig1offbtn = PushButton(app,
                        command=Flasher1Off,
                        text="CH1 OFF",
                        grid=sig1offbtn.grid)
sig2onbtn = PushButton(app,
                       command=Flasher2On,
                       text="CH2 ON",
                       grid=sig2onbtn.grid)
sig2offbtn = PushButton(app,
class GuiApp():
    '''Main GUI'''
    def __init__(self):
        '''Class contructor'''
        self.app = App(title="Kanban", width=WIDTH)
        MenuBar(self.app,
                toplevel=["File"],
                options=[[["Open", self.file_open], ["Save", self.file_save],
                          ["Exit", self.app.destroy]]])
        self.project_name = Text(self.app,
                                 text="Open a new project or add new tasks...")

        self.heading_box = Box(self.app,
                               align="top",
                               width="fill",
                               border=True)
        self.task_box = Box(self.app,
                            align="top",
                            width="fill",
                            border=True,
                            layout="grid")
        self.stage_box = Box(self.app, align="top", width="fill", border=True)
        self.control_box = Box(self.app,
                               align="bottom",
                               height="fill",
                               width="fill",
                               border=True)
        self.stage_list = []
        for stage in STAGE:
            self.stage_list.append(
                Text(self.heading_box, text=stage, align="left", width="fill"))
        self.todo_list = ListBox(self.task_box,
                                 height=200,
                                 width=WIDTH / 3,
                                 command=self.list_selected_todo,
                                 scrollbar=True,
                                 grid=[0, 0])
        self.inprogress_list = ListBox(self.task_box,
                                       height=200,
                                       width=WIDTH / 3,
                                       command=self.list_selected_inprogress,
                                       scrollbar=True,
                                       grid=[1, 0])
        self.done_list = ListBox(self.task_box,
                                 height=200,
                                 width=WIDTH / 3,
                                 command=self.list_selected_done,
                                 scrollbar=True,
                                 grid=[2, 0])
        self.lists = [self.todo_list, self.inprogress_list, self.done_list]
        self.regress_btn = PushButton(self.stage_box,
                                      text="Back",
                                      align="left",
                                      width="fill")
        self.stage = Text(self.stage_box, align="left", width="fill")
        self.progress_btn = PushButton(self.stage_box,
                                       text="Next",
                                       align="left",
                                       width="fill")
        self.title = Text(self.app, width="fill", align="top")
        self.description = TextBox(self.app,
                                   width="fill",
                                   align="bottom",
                                   height="fill",
                                   multiline=True,
                                   scrollbar=True)
        self.add_btn = PushButton(self.control_box,
                                  text="New",
                                  align="left",
                                  width="fill")
        self.remove_btn = PushButton(self.control_box,
                                     text="Delete",
                                     align="left",
                                     width="fill")
        #Set defaults
        self.file_name = None
        self.data = {STAGE[0]: [], STAGE[1]: [], STAGE[2]: []}
        self.selected = NONE_SELECTED
        self.app.tk.bind("<Configure>", self.resize_callback)
        self.app.display()

    def resize_callback(self):
        '''Resize list boxes'''
        for i in self.lists:
            i.width = self.app.width / 3

    def file_open(self):
        '''Open JSON file and load into data'''
        self.file_name = self.app.select_file(
            title="Select your task file",
            folder=".",
            filetypes=[["JSON documents", "*.json"], ["All files", "*.*"]])
        if self.file_name != '':
            self.project_name.value = os.path.basename(
                self.file_name).split(".")[0]
            with open(self.file_name) as json_file:
                self.data = json.load(json_file)
                self.load_tasks()

    def file_save(self):
        '''Save the data in JSON format'''
        self.file_name = self.app.select_file(
            title="Save a copy of your tasks",
            folder=".",
            filetypes=[["JSON documents", "*.json"], ["All files", "*.*"]],
            save=True)
        if self.file_name != '':
            with open(self.file_name, 'w') as outfile:
                json.dump(self.data, outfile, sort_keys=True, indent=4)
                self.project_name.value = os.path.basename(
                    self.file_name).split(".")[0]

    def load_tasks(self):
        '''Load the tasks into each of the ListBoxes'''
        for i, stage in enumerate(STAGE):
            self.lists[i].clear()
            for task in self.data[stage]:
                self.lists[i].append(task["title"])

    def list_selected_todo(self, title):
        '''called from todo_list'''
        self.list_selected(STAGE[0], title)

    def list_selected_inprogress(self, title):
        '''called from inprogress_list'''
        self.list_selected(STAGE[1], title)

    def list_selected_done(self, title):
        '''called from done_list'''
        self.list_selected(STAGE[2], title)

    def list_selected(self, stage, title):
        '''find details of selected task'''
        for task in self.data[stage]:
            if title in task["title"]:
                self.selected = {
                    "stage": stage,
                    "title": title,
                    "description": task["description"]
                }
                self.load_selected()

    def load_selected(self):
        '''load selected task on GUI'''
        self.stage.value = self.selected.get("stage", "")
        self.title.value = self.selected.get("title", "")
        self.description.value = self.selected.get("description", "")
#Import Modules
import random
from guizero import App, Picture, PushButton, Window, TextBox, Text, MenuBar
Background = "#00FFFF"
#Mainpage UI
app = App(height= 360, width= 520, title= "Score the cards!",bg= Background)

#Define Variables which will be used in future
score = 0  #SP Score
players = 0 #Amount of Players
scoremsg = str("pholder") #Final Score Message
addcheck = False #Check addition gamemode
subcheck = False #Check subtraction gamemode
inputcheck = "pholder"

RHeart = list(range(1, 13)) #Different suites
RDiamo = list(range(1, 13))
BSpade = list(range(1, 13))
BClove = list(range(1, 13))
cardList = [RHeart, RDiamo, BSpade, BClove] # Create 2D list from previous 4 lists
#2 Player variables
p1total = 0
p2total = 0
p1score = 0
p2score = 0
p1field = "pholder"
p2field = "pholder"
cards = 52

#Functions
Пример #12
0
# Imports ---------------

from guizero import App, TextBox, Drawing

# Functions -------------


def draw_meme():
    meme.clear()
    meme.image(0, 0, "woodpecker.png")
    meme.text(20, 20, top_text.value)
    meme.text(20, 320, bottom_text.value)


# App -------------------

app = App("meme")

top_text = TextBox(app, "top text", command=draw_meme)
bottom_text = TextBox(app, "bottom text", command=draw_meme)

meme = Drawing(app, width="fill", height="fill")

draw_meme()

app.display()
Пример #13
0

def camera():
    camera = PiCamera()

    camera.resolution = (320, 240)
    #camera.framerate = 25
    camera.framerate_range.high
    camera.start_preview()
    sleep(5)
    camera.stop_preview()
    width = 10
    height = 10


app = App(title="ROV controller", height=400, width=400, layout="grid")

slider = Slider(app, start=280, end=510, command=slider_changed, grid=[6, 3])
camera = PushButton(app, camera, text="Camera", grid=[3, 4])
right = PushButton(app, right, text="Right", grid=[4, 3])
neutral = PushButton(app, neutral, text="Neutral", grid=[3, 3])
left = PushButton(app, left, text="Left", grid=[2, 3])
forward = PushButton(app, forward, text="forward", grid=[3, 0])
stop = PushButton(app, stop, text="stop", grid=[3, 1])
reverse = PushButton(app, reverse, text="reverse", grid=[3, 2])
pumpon = PushButton(app, pumpon, text="Pump In", grid=[2, 5])
pumptop = PushButton(app, pumptop, text="Pump Stop", grid=[3, 5])
pumpoff = PushButton(app, pumpoff, text="Pump Out", grid=[4, 5])
linearin = PushButton(app, linearin, text="IN", grid=[2, 6])
linearmid = PushButton(app, linearmid, text="MID", grid=[3, 6])
linearout = PushButton(app, linearout, text="OUT", grid=[4, 6])
Пример #14
0
def count_class():
    '''This funcation counts the number of students in the selected class.'''
    total = 0
    for student in student_list:
        if class_combo.value in student.get_classes():
            total += 1
    show_total.value = "Total students: " + str(total)


# Empty lists to store all teachers and students
teacher_list = []
student_list = []

generate_teachers()
generate_students()

# create the application interface
app = App(title="Student management system")
# This is section where you add any GUI widgets
heading = Text(app, text="List of Teachers", color=(201, 50, 30))
#create a combo box with options to select. On click run the count class funcation
class_combo = Combo(
    app,
    options=["GRA", "BIO", "PHY", "MAT", "DTC", "ART", "ENG", "XYZ"],
    selected="black",
    command=count_class)
#show total text widget
show_total = Text(app, text="Total Students: *please select a class*")
# Start the program
app.display()
Пример #15
0
    selection.show()

def selection_chosen():
    selection.hide()
    if selection.value == "choose me":
        info("well done", "you chose wisely")
        goodbye()
    else:
        warn("arrrgh", "next time, choose wisely!")
        app.after(2000, show_the_selection)

def goodbye():
    change_message("Thanks")
    logo.show()

# create the app and the widgets
app = App()
message_text = Text(app, text = "Welcome to guizero")
button = PushButton(app, clicked_the_button, text = "Click me")
button.hide()
selection = ButtonGroup(app, selected = 0, command = selection_chosen, options = ["choose me", "don't choose me"])
selection.hide()
logo = Picture(app, "guizero.gif")
logo.hide()

# show the first message after 2 seconds
app.after(2000, message1)

app.display()

Пример #16
0
    print('launching password cracker challenge...')

    # change working directory to add file
    # os.chdir('')

    # TODO: add challenge user ?

    # TODO: implem subprocess
    subprocess.run([''])


#
# GuiZero components
#

app = App(title="password cracker")

prompt = """
Challenge 1:

all you need to do is get the password to access the next level.
the only problem is that it's contained in a password-protected file, too.
follow the steps to pwn the file and move on. 
"""

promptLabel = Text(app, text=prompt)  # add prompt to UI

goButton = PushButton(app, text="Let's go!",
                      command=lauchChallenge)  # will begin the challenge

app.display()
    def __init__(self):
        '''Class contructor'''
        self.app = App(title="Kanban", width=WIDTH)
        MenuBar(self.app,
                toplevel=["File"],
                options=[[["Open", self.file_open], ["Save", self.file_save],
                          ["Exit", self.app.destroy]]])
        self.project_name = Text(self.app,
                                 text="Open a new project or add new tasks...")

        self.heading_box = Box(self.app,
                               align="top",
                               width="fill",
                               border=True)
        self.task_box = Box(self.app,
                            align="top",
                            width="fill",
                            border=True,
                            layout="grid")
        self.stage_box = Box(self.app, align="top", width="fill", border=True)
        self.control_box = Box(self.app,
                               align="bottom",
                               height="fill",
                               width="fill",
                               border=True)
        self.stage_list = []
        for stage in STAGE:
            self.stage_list.append(
                Text(self.heading_box, text=stage, align="left", width="fill"))
        self.todo_list = ListBox(self.task_box,
                                 height=200,
                                 width=WIDTH / 3,
                                 command=self.list_selected_todo,
                                 scrollbar=True,
                                 grid=[0, 0])
        self.inprogress_list = ListBox(self.task_box,
                                       height=200,
                                       width=WIDTH / 3,
                                       command=self.list_selected_inprogress,
                                       scrollbar=True,
                                       grid=[1, 0])
        self.done_list = ListBox(self.task_box,
                                 height=200,
                                 width=WIDTH / 3,
                                 command=self.list_selected_done,
                                 scrollbar=True,
                                 grid=[2, 0])
        self.lists = [self.todo_list, self.inprogress_list, self.done_list]
        self.regress_btn = PushButton(self.stage_box,
                                      text="Back",
                                      align="left",
                                      width="fill")
        self.stage = Text(self.stage_box, align="left", width="fill")
        self.progress_btn = PushButton(self.stage_box,
                                       text="Next",
                                       align="left",
                                       width="fill")
        self.title = Text(self.app, width="fill", align="top")
        self.description = TextBox(self.app,
                                   width="fill",
                                   align="bottom",
                                   height="fill",
                                   multiline=True,
                                   scrollbar=True)
        self.add_btn = PushButton(self.control_box,
                                  text="New",
                                  align="left",
                                  width="fill")
        self.remove_btn = PushButton(self.control_box,
                                     text="Delete",
                                     align="left",
                                     width="fill")
        #Set defaults
        self.file_name = None
        self.data = {STAGE[0]: [], STAGE[1]: [], STAGE[2]: []}
        self.selected = NONE_SELECTED
        self.app.tk.bind("<Configure>", self.resize_callback)
        self.app.display()
Пример #18
0
from guizero import App, Text, TextBox, PushButton, Slider


def say_my_name():
    welcome_message.value = my_name.value


def change_text_size(slider_value):
    welcome_message.size = slider_value


app = App(title="Hello world")

welcome_message = Text(app,
                       text="Welcome to my app",
                       size=35,
                       font="Times New Roman",
                       color="lightblue")
my_name = TextBox(app, width=50)
update_text = PushButton(app, command=say_my_name, text="Display my name")
text_size = Slider(app, command=change_text_size, start=10, end=80)

app.display()
Пример #19
0
        toptext.text_color = "red"
    else:
        toptext.value = "Blue Wins"
        toptext.text_color = "blue"


#Function to reset the board
def reset():
    board.set_all("white")
    board.enable()
    global player1playing
    player1playing = True
    toptext.value = ""


#Creates the window/app
app = App("TicTacToe", height="200", width="200")
#Creates unseen text, updated when a player has won
toptext = Text(app, text="")
#Creates the board
board = Waffle(app,
               height=3,
               width=3,
               dim=50,
               pad=2,
               dotty=False,
               command=change_pixel)
#Creates the reset button
reset = PushButton(app, text="Reset", command=reset)
app.display()
from guizero import App, Text, PushButton, Combo, CheckBox, ButtonGroup


def btn_cmd():
    test_text.value = "Clicked"


app = App(title="Yo", width=200, height=160, layout="grid")
test_text = Text(app, text="Text", grid=[0, 0], align="left")
test_btn = PushButton(app,
                      command=btn_cmd,
                      text="Click",
                      grid=[1, 1],
                      align="left")
test_combo = Combo(app,
                   options=["Option 1", "Option 2"],
                   grid=[0, 1],
                   align="left")
test_check = CheckBox(app, text="Check", grid=[0, 2], align="left")
test_radio = ButtonGroup(app,
                         options=[["A", "A"], ["B", "B"]],
                         selected="A",
                         horizontal=False,
                         grid=[1, 0],
                         align="left")
app.display()
Пример #21
0
# ------------------------------


def setup_round():
    for picture in pictures:
        picture.image = emojis.pop()

    for button in buttons:
        button.image = emojis.pop()


# ------------------------------
# App
# ------------------------------

app = App("emoji match")

pictures_box = Box(app, layout="grid")
buttons_box = Box(app, layout="grid")

pictures = []
buttons = []

for x in range(0, 3):
    for y in range(0, 3):
        picture = Picture(pictures_box, grid=[x, y])
        pictures.append(picture)

        button = PushButton(buttons_box, grid=[x, y])
        buttons.append(button)
Пример #22
0
from guizero import App, Text, Box, PushButton


def do_nothing():
    return 0


app = App(title="Bunch of Buttons", height=300, width=300, layout="grid")
text = Text(app, text="Pick a number", grid=[0, 0])
box = Box(app, layout="grid", grid=[1, 0])
button1 = PushButton(box, command=do_nothing, text="1", grid=[0, 0])
button2 = PushButton(box, command=do_nothing, text="2", grid=[1, 0])
button3 = PushButton(box, command=do_nothing, text="3", grid=[2, 0])
button4 = PushButton(box, command=do_nothing, text="4", grid=[0, 1])
button5 = PushButton(box, command=do_nothing, text="5", grid=[1, 1])
button6 = PushButton(box, command=do_nothing, text="6", grid=[2, 1])
app.display()
Пример #23
0
#Imports
import random
from guizero import App, Picture, PushButton, Window, TextBox, Text
#app = App(layout="grid", height= 682, width= 1024, title= "Score the cards!")
app = App(height=682, width=1024, title="Score the cards!", bg="#00FFFF")

score = 0
players = 0
scoremsg = str("Theres something wrong with your code nick u idiot")
addcheck = "F"
subcheck = "F"
inputcheck = "pholder"
RHeart = list(range(1, 13))
RDiamo = list(range(1, 13))
BSpade = list(range(1, 13))
BClove = list(range(1, 13))
p1total = 0
p2total = 0
p1score = 0
p2score = 0
p1field = "pholder"
p2field = "pholder"
cardList = [RHeart, RDiamo, BSpade, BClove]

#Create seperate windows
window = Window(app,
                title="Player Select",
                height=682,
                width=1024,
                bg="#00FFFF")
window2 = Window(app,
Пример #24
0
    def __init__(self):

        self.dispenser = TestDispenser()
        self.cup_number = 0
        self.half_cup_number = 0
        self.eighth_cup_number = 0
        self.teaspoon_number = 0
        self.dispensing_id = Ingredient.SALT  # Default: id is salt (0)
        self.dispensing_id_text = SALT_DISPENSING_TEXT  # Default: salt
        self.dispensing_amount = 0
        self.dispensing_flag = False

        self.app = App(title="Pestle Co.")
        # All code must be added in th event loop
        # START
        # Set up the option window and hide it for now
        self.option_window = Window(self.app, title="Choosing a spice")
        self.option_window.hide()  # hide this window for now
        # Set up the dispensing window and hide it for now
        self.dispensing_window = Window(self.option_window, title="Dispensing")
        self.dispensing_window.hide()  # hide this window for now
        # Set up the welcome window
        #self.app.set_full_screen()
        self.welcome_message = Text(self.app,
                                    text="Pestle Co.",
                                    size=70,
                                    font="Times New Roman",
                                    color="blue")
        self.start_button = PushButton(self.app,
                                       command=self.open_option_window,
                                       text="Push to Start",
                                       width=20,
                                       height=5)
        self.start_button.text_color = (205, 133, 0)
        self.start_button.text_size = 30

        # Option page/window set up
        # Salt button
        self.salt_button = PushButton(self.option_window,
                                      command=self.open_salt_dispensing_window,
                                      text="Salt",
                                      align="top",
                                      width=10,
                                      height=2)
        self.salt_button.text_color = (205, 133, 0)
        self.salt_button.text_size = 20
        # Flour button
        self.flour_button = PushButton(
            self.option_window,
            command=self.open_flour_dispensing_window,
            text="Flour",
            align="top",
            width=10,
            height=2)
        self.flour_button.text_color = (205, 133, 0)
        self.flour_button.text_size = 20
        # Sugar button
        self.sugar_button = PushButton(
            self.option_window,
            command=self.open_sugar_dispensing_window,
            text="Sugar",
            align="top",
            width=10,
            height=2)
        self.sugar_button.text_color = (205, 133, 0)
        self.sugar_button.text_size = 20
        # Done button
        self.done_button = PushButton(self.option_window,
                                      command=self.close_option_window,
                                      text="Done",
                                      align="bottom",
                                      width=10,
                                      height=2)
        self.done_button.text_color = (205, 133, 0)
        self.done_button.text_size = 20

        # Dispensing page/window set up
        self.dispensing_text = Text(self.dispensing_window,
                                    text=self.dispensing_id_text)
        self.cup_button = PushButton(self.dispensing_window,
                                     command=self.add_a_cup,
                                     text="Cup")
        self.cup_number_text = Text(self.dispensing_window,
                                    text=str(self.cup_number) + " Cups(s)")
        self.cup_button.text_color = (205, 133, 0)
        self.cup_button.text_size = 20

        self.half_cup_button = PushButton(self.dispensing_window,
                                          command=self.add_a_half_cup,
                                          text="Half Cup")
        self.half_cup_number_text = Text(self.dispensing_window,
                                         text=str(self.half_cup_number) +
                                         " Half_cup(es)")
        self.half_cup_button.text_color = (205, 133, 0)
        self.half_cup_button.text_size = 20

        self.eighth_cup_button = PushButton(self.dispensing_window,
                                            command=self.add_a_eighth_cup,
                                            text="Eighth_cup")
        self.eighth_cup_number_text = Text(self.dispensing_window,
                                           text=str(self.eighth_cup_number) +
                                           " Eighth_cup(es)")
        self.eighth_cup_button.text_color = (205, 133, 0)
        self.eighth_cup_button.text_size = 20

        self.teaspoon_button = PushButton(self.dispensing_window,
                                          command=self.add_a_teaspoon,
                                          text="Teaspoon")
        self.teaspoon_number_text = Text(self.dispensing_window,
                                         text=str(self.teaspoon_number) +
                                         " Teaspoon(s)")
        self.teaspoon_button.text_color = (205, 133, 0)
        self.teaspoon_button.text_size = 20

        self.dispense_button = PushButton(self.dispensing_window,
                                          command=self.final_dispense,
                                          text="Dispense",
                                          align="bottom")
        self.reset_button = PushButton(self.dispensing_window,
                                       command=self.reset_measurement,
                                       text="Reset",
                                       align="bottom")
        # STOP
        print("here")
        self.app.display()
Пример #25
0
list_a = []
list_b = []
list_c = []
with open("insults.csv", "r") as f:
    for line in f:
        words = line.split(',')
        list_a.append(words[0])
        list_b.append(words[1])
        list_c.append(words[2])


def insult_me():
    word_a = choice(list_a)
    word_b = choice(list_b)
    word_c = choice(list_c)
    insult = "Thou {} {} {} !".format(word_a, word_b, word_c.rstrip())
    return insult


def new_insult():
    new_insult = insult_me()
    message.value = new_insult


app = App("Shakespearean Insult Generator")

message = Text(app, insult_me())
button = PushButton(app, new_insult, text="Insult Me Again...")
box = Box(app, width=10, height=10)
app.display()
from guizero import App, Box, Waffle, Slider, Text


def change_dim(slider):
    print("Changing size to {}x{} ".format(g_width.value, g_height.value))
    grid.resize(g_width.value, g_height.value)


app = App("Changing size")

grid = Waffle(app)

controls = Box(app, layout="grid")

# Width
width_text = Text(controls, text="Width", grid=[0, 0])
g_width = Slider(controls, start=0, end=20, command=change_dim, grid=[1, 0])
g_width.value = 4

# Height
height_text = Text(controls, text="Height", grid=[0, 1])
g_height = Slider(controls, start=0, end=20, command=change_dim, grid=[1, 1])
g_height.value = 4

app.display()
Пример #27
0
                                                event.y,
                                                color=(red.value, green.value,
                                                       blue.value))


def update_color():
    color_label.bg = (red.value, green.value, blue.value)
    color_label.text_color = (255 - red.value, 255 - green.value,
                              255 - blue.value)


def select_tool():
    line_width_box.visible = tool.value == "line"


a = App(title="Paintzero")

tool_box = Box(a, height="fill", border=True, align="left")
paint_box = Box(a, width="fill", height="fill", border=True, align="right")

tool = Combo(tool_box,
             options=["line", "rectangle", "oval"],
             selected="line",
             align="top",
             width="fill",
             command=select_tool)

color_label = Text(tool_box, text="color", align="top", width="fill")
color_label.bg = "black"
color_label.text_color = "white"
Пример #28
0
subscribe_data = {
    "type": "subscribe",
    "exchange": "binance",
    "pair": "btc-usdt",
    "channel": "trade"
}

client.connect()
#btcClient = client.subscribe(subscribe_data, handler)

#Setting up the GUI
#importing App from guizero
from guizero import App, Text

#Setting up the workspace
app = App(title="G33k's Cryptocurrency Ticker", width=600, height=400)
app.bg = "white"

test = "test"
#Print the cryptocurrencies to be displayed
btc = Text(app,
           text="Bitcoin (BTC):		${}".format(
               client.subscribe(subscribe_data, handler)),
           size=24)
bch = Text(app, text="Bitcoin Cash (BCH)		$", size=24)
eth = Text(app, text="Ethereum (ETH):		$", size=24)
xlm = Text(app, text="Stellar (XLM):		$", size=24)
xrp = Text(app, text="Ripple (XRP):		$", size=24)
dog = Text(app, text="Dogecoin (DOGE):		$", size=24)

app.display()
Пример #29
0
        g, g, k, k, k, k, g, g,
        g, g, k, k, k, k, g, g,
        g, g, k, g, g, k, g, g,
    ]


    sense.set_pixels(draw_pixels)
def shell():
    print("SHELL")
def pygamec():
    pygame.init()
    width = pygame.display.Info().current_w
    height = pygame.display.Info().current_h
    screen = pygame.display.set_mode((width, height))
    gui = pygame.image.load('PYGUI.png')
    gui = pygame.transform.scale (gui, (width, height))
    screen.blit(gui, (0,0))
    pygame.display.update()
    sleep(randrange(3, 5))
    pygame.quit()
pqtm = App(title="PythonOS")
wel = Text(pqtm, text="Welcome!", size=40, font="", color="lightblue")
shatb = PushButton(pqtm, command=shat, text="Sense HAT")
shellb = PushButton(pqtm, command=shell, text="Shell")
pygameb = PushButton(pqtm, command=pygamec, text="Pygame")
shatcb = PushButton(pqtm, command=senseclear, text="Clear Sense HAT Coding")
gpiob = PushButton(pqtm, command=gpiozeroc, text="GPIO")
exita = PushButton(pqtm, command=exitax, text="Exit")
shatc = PushButton(pqtm, command=shatnew, text="Sense HAT (Dev)")
pqtm.display()
    
Пример #30
0
from guizero import App, Text, PushButton


def open_settings():  #what to do when settings button is pressed
    text.value = "hello world"


#app setup
app = App(title="Erelas Local Monitor")
text = Text(app)

#buttons
button = PushButton(app, text="Settings", command=open_settings)

#intialise app
app.display()
Пример #31
0
# Imports ---------------
from guizero import App, Text, PushButton
from random import choice


# Functions -------------
def choose_name():
    #print("Button was pressed")
    first_names = [
        "Barbara", "Woody", "Tiberius", "Smokey", "Jennifer", "Ruby"
    ]
    last_names = [
        "Spindleshanks", "Mysterioso", "Dungeon", "Catseye", "Darkmeyer",
        "Flamingobreath"
    ]
    spy_name = choice(first_names) + " " + choice(last_names)
    print(spy_name)


# App -------------------
app = App("TOP SECRET")

# Widgets ---------------
title = Text(app, "Push the red button to find out your spy name")
button = PushButton(app, choose_name, text="Tell me!")
button.bg = "red"
button.text_size = 30

# Display ---------------
app.display()
Пример #32
0
        print("running")
        pause = not pause
        pauseState.value=("Running")
        hltFlame.visible=True
        rimsFlame.visible=True
        bkFlame.visible=True
    else:
        print("pausing")
        pause = not pause
        pauseState.value=("Paused")
        hltFlame.visible=False
        rimsFlame.visible=False
        bkFlame.visible=False
    return

app = App(title="Brew GUI", width=1280, height=768, layout="grid")
vertPad = Picture(app, image="blank_vert.gif", grid=[0,0])

hltBox = Box(app, layout="grid", grid=[1,0])
hltPad = Picture(hltBox, image="blank.gif", grid=[0,0])
hltTitle = Text(hltBox, text="HLT", grid=[0,1], align="top")
hltText = Text(hltBox, text="180", grid=[0,2], align="top")
hltSlider = Slider(hltBox, start=212, end=100, horizontal=False, grid=[0,3], align="top")
hltSlider.tk.config(length=500, width=50)
hltFlamePad = Picture(hltBox, image="blank_flame.gif", grid=[0,4])
hltFlame = Picture(hltBox, image="flame.gif", grid=[0,4])

rimsBox = Box(app, layout="grid", grid=[2,0])
rimsPad = Picture(rimsBox, image="blank.gif", grid=[0,0])
rimsTitle = Text(rimsBox, text="RIMS", grid=[0,1], align="top")
rimsText = Text(rimsBox, text="180", grid=[0,2], align="top")
Пример #33
0
from guizero import App, Text, TextBox, PushButton, Slider, Picture, Combo
import time


def say_my_name():
    welcome_msg.value = my_name.value


def change_text_size(slider_value):
    welcome_msg.size = slider_value


app = App(title="test", width=600, height=800, bgcolor="black", layout="grid")
#film_choice = Combo(app, options=["Star Wars", "Frozen", "Lion King"], grid = [7,0],align="left")
#film_description = Text(app, text="Which film?", align="left")
welcome_msg = Text(app,
                   text="Musical Picasso",
                   size=40,
                   color="#ffa500",
                   grid=[3, 0],
                   align="center")
#my_name=TextBox(app)
#update_text = PushButton(app, command=say_my_name, text="Display my name")
text_size = Slider(app,
                   command=change_text_size,
                   start=10,
                   end=100,
                   horizontal=False,
                   grid=[0, 1],
                   align="left",
                   visible=False)