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...")
     #Set defaults
     self.file_name = None
     self.data = {STAGE[0]: [], STAGE[1]: [], STAGE[2]: []}
     self.app.display()
Ejemplo n.º 2
0
def gui_1():
    main_screen = App(title="Welcome to my Robot")
    sleep(2)

    def function_1():
        main_screen.full_screen = True
        return

    def function_2():
        main_screen.full_screen = False
        return

    menu = MenuBar(main_screen,
                   toplevel=["File"],
                   options=[[["Fullscreen", function_1],
                             ["Exit Fullscreen", function_2]]])
    main_screen.display()
    return
def test_initial_values():
    a = App()

    callback_event = Event()

    def callback():
        callback_event.set()

    m = MenuBar(a, ["foo", "bar"], [[["foo1", callback], ["foo2", callback]],
                                    [["bar1", callback], ["bar2", callback]]])

    assert m.master == a

    assert not callback_event.is_set()

    # menu invoke doesnt work...
    # m.tk.invoke(0)
    # assert callback_event.is_set()

    a.destroy()
Ejemplo n.º 4
0
def gui_2():
    main_screen = App(title="Raspi-Robot")

    def function_1():
        main_screen.full_screen = True
        return

    def function_2():
        main_screen.full_screen = False
        return

    menu = MenuBar(main_screen,
                   toplevel=["File"],
                   options=[[["Fullscreen", function_1],
                             ["Exit Fullscreen", function_2]]])

    camera = PiCamera()
    camera.start_preview()
    sleep(5)
    camera.stop_preview()

    main_screen.display()
    return
Ejemplo n.º 5
0
def DoSomething():
    print("You have pushed my button")


def SliderChanged(value):
    textbox.value = value


def CheckBoxChanger():
    textbox1 = TextBox(app, text="Gays Burnt!")


menubar = MenuBar(app,
                  toplevel=["File", "Edit", "Settings"],
                  options=[[["File option 1", DoSomething],
                            ["File option 2", DoSomething]],
                           [["Edit option 1", DoSomething],
                            ["Edit option 2", DoSomething]],
                           [["Settings option 1", DoSomething],
                            ["Settings option 1", DoSomething]]])

textbox = TextBox(app, align="bottom")

text = Text(app,
            align="top",
            text="Hello GUI",
            color="blue",
            font="Times New Roman",
            size="30")
text1 = Text(app, align="bottom", text="General Kenobi")

picture = Picture(app, image="picture1.png", width=300, height=300)
Ejemplo n.º 6
0
    """
    A handler for telling the app which OTP to use
    """
    global otpfilename
    otpfilename = filedialog.askopenfilename(title="Open OTP",
                                             filetypes=(("text files",
                                                         "*.txt"),
                                                        ("all files", "*.*")))
    warn("OTP", "Using OTP " + otpfilename)


def closeHandler():
    """
    Handles the close event
    """
    if yesno("close", "Do you want to quit without saving?"):
        app.destroy()


ALPHABET = "abcdefghijklmnopqrstuvwxyz"
app = App(title="untitled", height=600, width=600)
data = TextBox(app, height=600, width=600, multiline=True, scrollbar=True)
otpfilename = ""
menubar = MenuBar(app,
                  toplevel=["File", "Encrypt"],
                  options=[[["Open File", openFile], ["Save File", saveFile]],
                           [["Encrypt", encryptFile], ["Decrypt", decryptFile],
                            ["Make OTP", OTPHandler],
                            ["Set OTP", SetOTPHandler]]])
app.on_close(closeHandler)
app.display()
running = True


def exit():
    global running
    running = False


app = App(title="Microfluidics Station",
          width=WINDOW_X,
          height=WINDOW_Y,
          layout="grid",
          visible=False,
          bg="white")
menubar = MenuBar(app, toplevel=["File"], options=[
    [["Exit", exit]],
])

pid_status_str = ["Unconfigured", "Idle", "Heating", "Suspended", "Error"]

autotune_status_str = ["None", "Running", "Aborted", "Finished", "Failed"]


def update_gui():
    heater1.update()
    heater2.update()
    heater3.update()
    heater4.update()


picommon.spi_init(0, 2, 30000)
Ejemplo n.º 8
0
y = random.randint(0,9)
compShip = [x,y] # location of computer ship
playerShip = []  # Location that player chooses
print(compShip)
aiSearchLocations = []  # Locations ai will search
mHistory = "" #Stores ai missile attempts

#Windows and Boxes
battleBoard = App(title="Ship Shooter",width=700,height=700,layout="grid")
playerBoard = Box(battleBoard,layout="grid",grid=[0,0])
compBoard = Box(battleBoard,layout="grid",grid=[1,0])
textBoxes = Box(battleBoard,layout="grid",grid=[0,1],align='left')
missileBox = Box(battleBoard,layout="grid",grid=[0,2],align='right')
menubar = MenuBar(battleBoard,
                  toplevel=["Game"],
                  options=[
                      [ ["Easy", reInitialise], ["Normal", reInitialise], ["Hard", reInitialise] ]
                  ])

#Game boards for ships
playerWaffle = Waffle(playerBoard,height=10,width=10,dim=29,grid=[0,0],color="blue",command=pClicked)
computerWaffle = Waffle(compBoard,height=10,width=10,dim=29,grid=[0,0],color="aqua",command=cClicked)

#Text information
Text(textBoxes,text="Missiles remaining: ",size=18,color="blue",grid=[0,0],align='left')
playerText = Text(textBoxes,text="Players ship is at: ",size=18,color="blue",grid=[0,1],align='left')
missilesText = Text(textBoxes,text=missiles,size=18,grid=[1,0],color="blue")
compText = Text(textBoxes,text=compShip,size=18,color="green",grid=[0,2])
missileHistory = Text(textBoxes,text=mHistory,size=12,color="red",grid=[0,3])

#starting settings
Ejemplo n.º 9
0
            warn("Error", "This folder contains no image files")
        show_file(file_pointer)
    except Exception as e:
        warn("Exception thrown",
             "Invalid folder.  Please select valid folder.")


# declare our main app
app = App(
    title="Madeleine Ward Marker Prototype",
    width=IMAGE_WIDTH,
    height=IMAGE_HEIGHT,
)

# CANVAS contains an image with lines that indicate species present
canvas = Drawing(app, width=IMAGE_WIDTH, height=IMAGE_HEIGHT)

# hook the events to the canvas object
canvas.when_left_button_pressed = canvas_left_click
canvas.when_right_button_pressed = canvas_right_click

# define the menu bar
menubar = MenuBar(app,
                  toplevel=["File", "Mark Images"],
                  options=[[["Pick Directory", pick_directory]],
                           [["Mark Images", mark_function]]])

# hook the arrow keys (for now, might want to change this to local hook if permitted)
app.when_key_pressed = keypress_hook

app.display()
Ejemplo n.º 10
0

app.set_full_screen()
print("Initialising Modem..")
serialport = serial.Serial("/dev/ttyAMA0", 115200, timeout=0.5)
serialport.write("AT\r".encode())
response = serialport.readlines(None)
serialport.write("ATE0\r".encode())
response = serialport.readlines(None)
serialport.write("AT\r".encode())
response = serialport.readlines(None)
print(response)

menubar = MenuBar(app,
                  toplevel=["Options"],
                  options=[
                      [["Fix Window", fixwindow], ["Quit", killwindow]],
                  ])

text1 = Text(app,
             text="Step 1) Retrieve package from box in drone",
             grid=[0, 0],
             color="black")

text2 = Text(app, text="Step 2) Power on device", grid=[0, 1], color="black")
##
text3 = Text(app,
             text="Step 3) Place paddles on chest of patient",
             grid=[0, 2],
             color="black")
##
Ejemplo n.º 11
0
def image_enhance():
    global filename
    print(filename)
    base = os.path.basename(filename)
    img_name = os.path.splitext(base)
    img_name = str(img_name[0] + img_name[1])
    print(img_name)
    print("here")
    picture1.value = "enhanced/" + img_name


app = App(title="Image Processing",
          bg="#ff8787",
          height=500,
          width=800,
          layout="grid")
menubar = MenuBar(app,
                  toplevel=["File"],
                  options=[[["Upload File", select_image]]])
picture = Picture(app, image="default.png", grid=[0, 0])
picture1 = Picture(app, image="default.png", grid=[1, 0])
text = Text(app, text="Original", grid=[0, 1])
text1 = Text(app, text="Enhanced", grid=[1, 1])
box = Box(app, grid=[0, 2])
button3 = PushButton(box,
                     command=image_enhance,
                     text="Enhance",
                     padx=20,
                     pady=30)
app.display()
Ejemplo n.º 12
0
def get_Text():  # Function to take value of number entered

    flowtext.value = input_box.get()
    if ChkUsrInputX.chkUsrNum(flowtext.value):
        #s.write(flow.SetPoint_Write(flowtext.value))
        print("Worked")
    else:
        # Error message
        warn("Oops", "Not a Valid Number.")


file_op = [["File", file_Exit], ["file2", get_Text]]
edit_op = [["log window", log_window], ["edit2", get_Text]]
app = App(title="Mass Flow Control")
menuebar = MenuBar(app, ["File", "Edit"], [file_op, edit_op])
box = Box(app)
box.bg = "red"
box.height = 200
box.repeat(1000, counter)
#logbox.repeat(1000,log_data )
#box.tk.configure(height =200, width = 200, background = "blue")
#for child in box.tk.winfo_children():
#	child.configure(background="blue")

text1 = Text(box, text="Hello box")
#text1.tk.configure(background="blue")
Message = Text(app, text="Sierra Instruments Micro Trak 101")
text = Text(app)
button = PushButton(app, text="Enter", command=get_Text)
#mywindow = Window(app, title = "Flow")
Ejemplo n.º 13
0
def howto():
    info(
        title="How to play!",
        text=
        "This is a very simple game, every matrix has a corresponding button, you need to guess where the random battleship is located!\n Good Luck :-)"
    )


app = App(title="Battleship!")

#Start the game!
ship_row, ship_col = new()
print("MAIN:", ship_row, ship_col)
#Menu bar
menubar = MenuBar(app,
                  toplevel=["Options"],
                  options=[[["New Game", reset], ["How to Play", howto]]])
#Matrix to view where you are clicking
p = Text(app, text="Matrix to view:")
my_waffle = Waffle(app, height=5, width=5, pad=1, dim=40, remember=True)

#Maybe keep maybe delete!
#new_game = PushButton(app, command=reset, text="New Game", grid=[0,1])

#Counter:
count = 5
c = Text(app, text="Matrix to click and play:")

#Matrix to click and play
box2 = Box(app, layout="grid", grid=[0, 5])
b1 = PushButton(box2, command=check, args=[0, 0], text=" 1 ", grid=[0, 0])
 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",
                                   command=self.regress_task)
     self.stage = Text(self.stage_box, align="left", width="fill")
     self.progress_btn = PushButton(self.stage_box,
                                    text="Next",
                                    align="left",
                                    width="fill",
                                    command=self.progress_task)
     self.title = Text(self.app, width="fill", align="top")
     self.description = TextBox(self.app,
                                width="fill",
                                align="bottom",
                                height="fill",
                                multiline=True,
                                scrollbar=True,
                                command=self.update_task)
     self.add_btn = PushButton(self.control_box,
                               text="New",
                               align="left",
                               width="fill",
                               command=self.add_task)
     self.remove_btn = PushButton(self.control_box,
                                  text="Delete",
                                  align="left",
                                  width="fill",
                                  command=self.remove_task)
     #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()
Ejemplo n.º 15
0
    def __init__(self, app, text, cd, test_window, scanner_window):
        Window.__init__(self, app, title="MTG Sorter", layout="grid")
        self.tk.attributes("-fullscreen", True)

        # Components
        def open_test():
            test_window.open_window()

        def open_scanner():
            scanner_window.show()

        def update_database():
            app.show()
            app.focus()
            cd.di = None
            cd.download(app_output=app, text_output=text)

        def toggle_fullscreen():
            global fullscreen
            fullscreen = not fullscreen
            self.tk.attributes("-fullscreen", fullscreen)
            test_window.tk.attributes("-fullscreen", fullscreen)

        def end_program():
            app.destroy()

        MenuBar(self,
                toplevel=["Windows", "Program"],
                options=[[["Test", open_test], ["Scanner", open_scanner]],
                         [["Update Database", update_database],
                          ["Toggle Fullscreen", toggle_fullscreen],
                          ["End Program", end_program]]])
        Text(self, text="MTG Sorter", grid=[0, 0, 2, 1])
        Text(self, text="Slot 1 Types", grid=[0, 1])
        Text(self, text="Slot 2 Types", grid=[1, 1])
        types = [
            "Artifact", "Creature", "Enchantment", "Instant", "Land",
            "Legendary", "Planeswalker", "Sorcery", "Tribal"
        ]
        checkboxes1 = []
        for n in range(9):
            checkboxes1.append(CheckBox(self, text=types[n], grid=[0, n + 2]))
            checkboxes1[n].width = 22
            checkboxes1[n].text_size = 20
        checkboxes2 = []
        for n in range(9):
            checkboxes2.append(CheckBox(self, text=types[n], grid=[1, n + 2]))
            checkboxes2[n].width = 22
            checkboxes2[n].text_size = 20

        def sort():
            nothing_selected1 = True
            for c in checkboxes1:
                if c.value:
                    nothing_selected1 = False
                    break
            nothing_selected2 = True
            for c in checkboxes2:
                if c.value:
                    nothing_selected2 = False
                    break
            if nothing_selected1 and nothing_selected2:
                print("nothing selected")
                return
            arm.reset()
            print("Sorting cards...")
            while True:
                img = scanner.scan_card()[3]
                if img is not None:
                    card = cd.get_card(img)
                    if card is None:
                        print("0")
                        arm.move_card(1, 2)
                    else:
                        card_type = card.type
                        print(card_type)
                        moved = False
                        for c in checkboxes1:
                            if c.value:
                                if c.text in card_type:
                                    print("1")
                                    arm.move_card(1, 3)
                                    moved = True
                                    break
                        if moved:
                            continue
                        for c in checkboxes2:
                            if c.value:
                                if c.text in card_type:
                                    print("2")
                                    arm.move_card(1, 4)
                                    break
                        if moved:
                            continue
                        print("0")
                        arm.move_card(1, 2)
                elif cd.is_empty():
                    print("tray is empty")
                    break
                else:
                    print("0")
                    arm.move_card(1, 2)
            arm.set_servo(0)

        PushButton(self, command=sort, text="Sort Cards", grid=[0, 11, 2, 1])
Ejemplo n.º 16
0
def savePoint():
    if connected == False:
        app.info("Info", "No GNSS device connected...")
        return
    
    global measure
    measure = True
    button_measure.enabled = False

app = App(title="Land Survey", width=350, height=400)
#app.tk.attributes("-fullscreen", True)

menubar = MenuBar(app,
                  toplevel=["File", "Help"],
                  options=[
                      [ ["New", createProject], ["Open", openProject], ["Exit", closeApp] ],
                      [ ["About", about] ]
                  ])

# Set up instrument height
instrument_setup_box = Box(app, width="fill", align="top")

text_instrument_height = Text(instrument_setup_box, text="Instrument Height:", align="left")
input_instrument_height = TextBox(instrument_setup_box, text="{:.3f}".format(instrument_height), align="left")
text_height_unit = Text(instrument_setup_box, text="m", align="left")
button = PushButton(instrument_setup_box, text="Set", padx=20, command=setInstrumentHeight, align="right")

# Measure
buttons_box = Box(app, width="fill", align="bottom")

button_connect = PushButton(buttons_box, text="Connect", command=connectDevice, align="left")
Ejemplo n.º 17
0
    def __init__(self, logger=logger):

        if platform.system() != "Darwin":
            app_height = 300
        else:
            app_height = 200
        app = App(title="Codelab Adapter v2", width=300, height=app_height)
        self.app = app
        self.slogan = Text(self.app, height=5, text="Everything Is Message!")
        self.slogan.text_color = (108, 108, 108)
        self.slogan.text_size = 18
        self.app.tk.wm_protocol("WM_DELETE_WINDOW", self.handle_delete_window)
        self.logger = logger
        self.menubar = MenuBar(
            self.app,
            toplevel=[
                "language",
                "帮助",
                '插件',
                '关于',
                "日志",
            ],  # todo? "烧录固件"
            options=[
                [["简体中文", self.change_to_zh], ["english", self.change_to_en]],
                [
                    ["实验室(Lab)", self.help_open_lab],
                    # ["社区(Community)", self.help_open_community],
                    ["文档(Document)", self.help_open_docs],
                    ["调试(Debug)", self.help_open_message_browser],
                    ["view log", self.help_open_web_log_page],
                    ["https校验(verify)", self.ssl_help],
                ],
                [["更新插件(Update extensions)", self.update_extensions_dir],
                 ["查看目录(Directory)", self.show_extensions_dir],
                 ["下载(Download)", self.handle_download_extension]],
                [
                    ["about codelab_adapter", self.show_about],
                    ["license", self.show_license],
                    ["version", self.show_version],
                    ["why", self.show_why],
                    ["fun", self.show_fun],
                    ["changelog", self.show_changelog],
                    # ["python3 path",self.show_pip3_path]
                ],
                # [["日志目录", self.show_log_dir], ["查看日志", self.show_log]],
                [["目录(Directory)", self.show_log_dir]],
                # [ ["microbit",self.flash_microbit] ]
            ])
        self.button1 = PushButton(
            self.app,
            command=self.webui,
            text="Web UI",
            # height=5,
            # grid=[1, 0]
        )
        # mac os 10.14 bug
        self.button2 = PushButton(
            self.app,
            command=self.exit,
            text="退出",
            # width=10,
            # height=5,
            # grid=[1, 0]
        )

        self.app.tk.report_callback_exception = self.report_callback_exception
Ejemplo n.º 18
0
    def __init__(self, app, text, cd, test_window, scanner_window):
        Window.__init__(self, app, title="MTG Sorter", layout="grid")
        self.tk.attributes("-fullscreen", True)

        # Top MenuBar
        def open_test():
            test_window.open_window()
        def open_scanner():
            scanner_window.show()

        def update_database():
            app.show()
            app.focus()
            cd.di = None
            cd.download(app_output=app, text_output=text)
        def toggle_fullscreen():
            global fullscreen
            fullscreen = not fullscreen
            self.tk.attributes("-fullscreen", fullscreen)
            test_window.tk.attributes("-fullscreen", fullscreen)
        def end_program():
            app.destroy()
        MenuBar(self,
                toplevel=["Windows", "Options"],
                options=[
                    [["Test", open_test], ["Scanner", open_scanner]],
                    [["Update Database", update_database], ["Toggle Fullscreen", toggle_fullscreen], ["End Program", end_program]]
                ])

        # Middle Card Type CheckBoxes
        Text(self, text="MTG Sorter", grid=[0, 0, 2, 1])
        Text(self, text="Slot 1 Types", grid=[0, 1])
        Text(self, text="Slot 2 Types", grid=[1, 1])
        types = ["Artifact", "Creature", "Enchantment", "Instant", "Land",
                 "Legendary", "Planeswalker", "Sorcery", "Tribal"]
        checkboxes1 = []
        for n in range(9):
            checkboxes1.append(CheckBox(self, text=types[n], grid=[0, n + 2]))
            checkboxes1[n].width = 22
            checkboxes1[n].text_size = 20
        checkboxes2 = []
        for n in range(9):
            checkboxes2.append(CheckBox(self, text=types[n], grid=[1, n + 2]))
            checkboxes2[n].width = 22
            checkboxes2[n].text_size = 20

        # Bottom Sort Cards Button
        def sort():

            # if nothing is selected in any column, do not sort
            nothing_selected1 = True
            for c in checkboxes1:
                if c.value:
                    nothing_selected1 = False
                    break
            nothing_selected2 = True
            for c in checkboxes2:
                if c.value:
                    nothing_selected2 = False
                    break
            if nothing_selected1 and nothing_selected2:
                print("nothing selected")
                return

            # reset arm to begin sorting
            arm.reset()
            print("Sorting cards...")

            # scan each card
            while True:
                img = scanner.scan_card()[3]
                if img is not None:
                    card = cd.get_card(img)
                    # if card isn't recognized, move it to bin 4
                    if card is None:
                        print("0")
                        arm.move_card(1, 4)
                    else:
                        card_type = card.type
                        print(card_type)
                        moved = False
                        # if card is any of the card types selected for the first bin, move it to bin 2
                        for c in checkboxes1:
                            if c.value:
                                if c.text in card_type:
                                    print("1")
                                    arm.move_card(1, 2)
                                    moved = True
                                    break
                        if moved:
                            continue
                        # if card is any of the card types selected for the second bin, move it to bin 3
                        for c in checkboxes2:
                            if c.value:
                                if c.text in card_type:
                                    print("2")
                                    arm.move_card(1, 3)
                                    break
                        if moved:
                            continue
                        # if card doesn't fit any of the selected types, move it to bin 4
                        print("0")
                        arm.move_card(1, 4)
                # if the tray is empty, end the sorting algorithm
                elif cd.is_empty():
                    print("tray is empty")
                    break
                # if the tray isn't empty but the card art can't be found, move the card to bin 4
                else:
                    print("0")
                    arm.move_card(1, 4)
            
            arm.set_servo(0)
        PushButton(self, command=sort, text="Sort Cards", grid=[0, 11, 2, 1])
Ejemplo n.º 19
0
    button0.enable()
    

def close_app():
    app.destroy()

# App
app = App("Hyannis Marina", width=1140, height=700)
app.bg = (115, 160, 230)
#app.tk.attributes("-fullscreen",True)

# Widgets
menubar = MenuBar(app,
                  toplevel=["File", "Edit"],
                  options=[
                      [ ["Today's Report", todays_report], [today.strftime("%Y Report"), yearly_report],\
                        ["Recent Reports", white_card_folder]],
                      [ ["Today's List", open_window]]
                  ])

title = Text(app, "Yard Crew", color="White", size=30, font="Quicksand Medium")
tech = Combo(app, options=techCombo + ["Tech"], selected="Tech" , command=writeTech)
tech.text_size = 30
tech.bg = "white"
spacer = Box(app, width="fill", height=20)
pic = Picture(app, image=str(main_image))
pic.width = 460
pic.height = 345
spacer2 = Box(app, width="fill", height=30)
close = PushButton(app, text="Exit", command=close_app)
Ejemplo n.º 20
0
def saveFile():
    global data
    app.filename = filedialog.asksaveasfilename(initialdir="/", title="Save as", filetypes = (("text files", "*.txt"),("all files", "*.*")))
    warn("This File?", "Saving as "+app.filename)
    print(data.value)
    theFile = open(app.filename, "w")
    theFile.write(data.value)
    app.title=app.filename
    theFile.close()

def encryptFile():
    warn("Error", "I don't know how to do that yet")
    
def decryptFile():
    warn("Error", "I don't know how to do that yet")


def closeHandler():
    global theFile
    if yesno("close", "Do you want to quit without saving?"):
        app.destroy()

app = App(title="untitled", height=600, width=600)
data = TextBox(app, height=600, width=600, multiline=True, scrollbar=True)
menubar = MenuBar(app, toplevel = ["File", "Encrypt"],
                  options=[
                      [["Open File", openFile], ["Save File", saveFile]],
                      [["Encrypt", encryptFile], ["Decrypt", decryptFile]]
                    ])
app.on_close(closeHandler)
app.display()
Ejemplo n.º 21
0
from guizero import App, PushButton, MenuBar, info
import com
import pygame
pygame.mixer.init()
app = App(title="Druaga1 Soundboard", layout="grid")
menubar = MenuBar(app,
                  toplevel=["File", "Help"],
                  options=[[["Exit", com.exit]],
                           [["About", com.about], ["View Code",
                                                   com.viewcode]]])
ssd1 = PushButton(app, command=com.ssd1, text="SSD1", grid=[0, 1])
ssd2 = PushButton(app, command=com.ssd2, text="SSD2", grid=[0, 2])
button3 = PushButton(app, command=com.testb3, text="Test2", grid=[1, 1])
app.display()
Ejemplo n.º 22
0
from guizero import App, Text, Picture, PushButton, MenuBar, Slider, CheckBox, Combo

app = App()
text = Text(app, align="bottom", text="This is GUI", color="blue", font="Times New Roman", size="70")


def do_somthing():
    print("you have a button")
    picture = Picture(app, image="Image.gif")
def do_something():
    print("you did something else")

menubar = MenuBar(app, toplevel=["file", "edit", "settings", "window"], options=[
    [["File Option 1", do_something], ["file Option 2", do_something]],
    [["edit Option 1", do_somthing], ["edit Option 2", do_somthing]],
    [["settings Option 1", do_somthing], ["settings Option 2", do_somthing]],
    [["Window Option 1", do_somthing], ["Window Option 2", do_somthing]],
])
button = PushButton(app, text="Push me!", align="right", width="3", height="2", command=do_somthing)
button.text_color = "blue"
button.text_size = "50"
slider = Slider(app, end="200")
checkbox = CheckBox(app, text="tick box")
combo = Combo(app, options=["first", "Second", "Third"])

app.display()

Ejemplo n.º 23
0
    def update_lastaction(self, txtbox, file) -> None:
        data = self.read_file(file)
        txtbox.value = "BUY" if not data["margin"] == " " else "SELL"
        txtbox.bg = "#38BC38" if not data["margin"] == " " else app.bg


### Size, Color, and Title can be modified here ###

app = App(layout="grid", height=730, width=1320)
app.title = "Pycryptobot SimpleGUI V0.2"
app.bg = "black"
app.text_color = "white"

### menu bar ###
menu = MenuBar(app,
               toplevel=["Display Options"],
               options=[[["Background Color", main_bg],
                         ["Text Color", text_clr], ["About", about]]])
###labels for the top of the display###
tpair_label = Text(app, text=" Trading Pair", grid=[0, 1])
exchange_label = Text(app, text="Exchange", grid=[1, 1])
action_label = Text(app, text="Last Action", grid=[2, 1])
curprice = Text(app, text="Current Price", grid=[3, 1])
margin_label = Text(app, text="Margin", grid=[4, 1])
profit_label = Text(app, text="Delta", grid=[5, 1])
ERI_label = Text(app, text="ERI", grid=[6, 1])
BULL_label = Text(app, text="BULL", grid=[7, 1])
EMA_label = Text(app, text="EMA", grid=[8, 1])
MACD_label = Text(app, text="MACD", grid=[9, 1])
OBV_label = Text(app, text="OBV", grid=[10, 1])

###making boxes for the display###
Ejemplo n.º 24
0
def h():
    app = App(width=800, height=800, title="my first GUI")
    app.bg = (156, 153, 153)
    init_control()

    # menu bar
    menubar = MenuBar(app,
                      toplevel=["File", "view"],
                      options=[[["music", music_window], ["Exit", exit_app]],
                               [["full-screen", full_screen],
                                ["normal screen", normal_screen]]])
    name_box = Box(app, border=1, width="fill")
    Text(name_box,
         font="Times New Roman",
         text="Hosni RPi-GUI-App",
         width="fill",
         color=(0, 0, 128))
    # win of music
    Text(app,
         font="Times New Roman",
         text="Music",
         width="fill",
         color=(145, 15, 15))
    music_box1 = Box(app, border=1, width="fill")
    music_window_button = PushButton(
        music_box1, align="left", text="Music", command=music_window
    )  #, image = "/home/pi/Desktop/music/download.png")
    music_volume_slider = Slider(music_box1,
                                 start=100,
                                 end=0,
                                 command=music_volume,
                                 height="fill",
                                 width=20,
                                 horizontal=False,
                                 align="left")
    music_box2 = Box(music_box1, align="left", width="fill")
    music_play_button = PushButton(music_box2,
                                   text="Play",
                                   command=start_music,
                                   width="fill")
    music_pause_button = PushButton(music_box2,
                                    text="Pause",
                                    command=pause_music,
                                    width="fill")
    music_continue_button = PushButton(music_box2,
                                       text="Continue",
                                       command=continue_music,
                                       width="fill")
    music_next_button = PushButton(music_box2,
                                   text="next",
                                   command=next_music,
                                   width="fill")
    music_previous_button = PushButton(music_box2,
                                       text="previous",
                                       command=previous_music,
                                       width="fill")
    #box3 = Box(box1,align = "left", width = "fill")
    #music_volume = Slider(box3,start = 100, end = 0 ,command = volume, height = 200, horizontal = False, align = "left")

    # led intensity
    text_ledpwm = Text(app,
                       font="Times New Roman",
                       text="LED intensity",
                       width="fill",
                       color=(145, 15, 15))
    box4 = Box(app, border=1, width="fill")
    LEDPwm = Slider(box4,
                    command=LED_intensity_control,
                    width="fill",
                    align="left")
    LEDPwm.bg = (255, 255, 255)
    text2 = Text(box4, text="D of LED = 0 %", align="left")
    text2.text_color = (0, 0, 128)

    # Fan speed
    fan_speed_text = Text(app,
                          font="Times New Roman",
                          text="Fan speed",
                          width="fill",
                          color=(145, 15, 15))
    fan_speed_box = Box(app, border=1, width="fill")
    fan_speed_slider = Slider(fan_speed_box,
                              command=fan_speed_control,
                              width="fill",
                              align="left")
    fan_speed_slider.bg = (255, 255, 255)
    fan_speed_display = Text(fan_speed_box, text="D of fan= 0 %", align="left")
    fan_speed_display.text_color = (0, 0, 128)

    # Ddisplay on lcd
    lcd_text = Text(app,
                    font="Times New Roman",
                    text="LCD",
                    color=(145, 15, 15))
    lcd_box = Box(app, border=1, width="fill")
    lcd_text_box = TextBox(lcd_box, width="fill", align="left")
    disply_lcd = PushButton(lcd_box,
                            text="Display",
                            command=display_on_lcd,
                            align="left")
    lcd_text_box.bg = (255, 255, 255)
    lcd_text_box.text_size = 15

    # Servo motor
    servo_text = Text(app,
                      font="Times New Roman",
                      text="Servo angle",
                      width="fill",
                      color=(145, 15, 15))
    servo_box1 = Box(app, border=1, width="fill")
    servo_angle = TextBox(servo_box1, width="fill", align="left")
    rotate = PushButton(servo_box1,
                        text="Rotate",
                        align="left",
                        command=servo_rotate)
    servo_box2 = Box(app, border=1, width="fill")
    rotate_0 = PushButton(servo_box2,
                          text="Rotate 0 ",
                          align="left",
                          width="fill",
                          command=servo_rotate_zero)
    rotate_90 = PushButton(servo_box2,
                           text="Rotate 90",
                           align="left",
                           width="fill",
                           command=servo_rotate_90)
    rotate_180 = PushButton(servo_box2,
                            text="Rotate180",
                            align="left",
                            width="fill",
                            command=servo_rotate_180)
    servo_angle.bg = (255, 255, 255)
    servo_angle.text_size = 15

    # Control room light
    room_text = Text(app,
                     font="Times New Roman",
                     text="Room Light",
                     width="fill",
                     color=(145, 15, 15))
    room_box = Box(app, border=1, width="fill")
    room_turnon = PushButton(room_box,
                             text="Turn on",
                             width="fill",
                             command=turn_on,
                             align="left")
    room_turnoff = PushButton(room_box,
                              text="Turn off",
                              width="fill",
                              command=turn_off,
                              align="left")
    room_state = Text(room_box, align="left")
    room_state.value = "OFF"
    room_state.text_color = (102, 0, 51)

    Text(app)

    # Box which group the four boxes
    sensors_box = Box(app, width="fill")

    # display ultrasonic reading
    ultrasonic_box = Box(sensors_box, border=1, width="fill", align="left")
    ultrasonic_text = Text(ultrasonic_box,
                           font="Times New Roman",
                           text="Ultrasonic Reading",
                           width="fill",
                           color=(145, 15, 15))
    ultrasonic_reading_text = Text(ultrasonic_box, text="the Distance = 0 CM")
    ultrasonic_reading_text.repeat(200, ultrasonic_measure)

    # PIR object Detection
    PIR_box = Box(sensors_box, border=1, width="fill", align="left")
    PIR_text = Text(PIR_box,
                    font="Times New Roman",
                    text="Object Detection",
                    width="fill",
                    color=(145, 15, 15))
    PIR_reading_text = Text(PIR_box)
    PIR_reading_text.repeat(150, PIR_detect)

    # Sound sensor
    sound_box = Box(sensors_box, border=1, width="fill", align="left")
    sound_text = Text(sound_box,
                      font="Times New Roman",
                      text="Sound Detection",
                      width="fill",
                      color=(145, 15, 15))
    sound_reading_text = Text(sound_box)
    sound_reading_text.repeat(200, sound_detect)

    # flame sensor
    flame_box = Box(sensors_box, border=1, width="fill", align="left")
    flame_text = Text(flame_box,
                      font="Times New Roman",
                      text="Flame Detection",
                      width="fill",
                      color=(145, 15, 15))
    falme_reading_text = Text(flame_box)
    falme_reading_text.repeat(200, flame_detect)

    app.display()
Ejemplo n.º 25
0
    selected_angle = 2 + (int(arm_angle.value) / 18)
    servo_arm_value.ChangeDutyCycle(selected_angle)
    sleep(0.5)
    servo_arm_value.ChangeDutyCycle(0)


# Create the GUI application.
appWidth = 1200
appHeight = 500
app = App(title="Air Quality Module",
          bg="#eb2e00",
          width=appWidth,
          height=appHeight)
# Define menu bar options.
menubar = MenuBar(app,
                  toplevel=["Tutorial", "Components", "About"],
                  options=[[["View", Tutorial]], [["Inspect", Components]],
                           [["About", About]]])
# Design the interface using the box widget.
top = Box(app, width="fill", height=appHeight / 2, align="top")
bottom = Box(app, width="fill", height=appHeight / 2, align="bottom")
color_interface = Box(top,
                      width=appWidth / 2,
                      align="left",
                      layout="grid",
                      border=True)
quality_interface = Box(top, width=appWidth / 2, align="right")
base_interface = Box(bottom, width=appWidth / 2, align="left")
arm_interface = Box(bottom, width=appWidth / 2, align="right")

# RGB Color Interface
color_header = Text(color_interface,
Ejemplo n.º 26
0

def get_last_pic() -> Path:
    """ returns the lastest picture in the current lot folder """
    p = (PICTURES_DIRECTORY / lotname).glob('**/*')
    files = [x for x in p if x.is_file()]
    latest = max(files, key=os.path.getctime)
    return latest


def show_picture():
    global box
    path = str(get_last_pic())
    picture = Picture(box,
                      image=path,
                      grid=[1, 2],
                      width=PICTURE_WIDTH,
                      height=PICTURE_HEIGHT)


app = App(title="Hello world", width=WINDOW_WIDTH, height=WINDOW_HEIGHT)

menubar = MenuBar(app,
                  toplevel=["File", "Edit"],
                  options=[[["New Lot", new_lot], ["Open Lot", open_lot]],
                           [["Edit Lot Name", edit_function],
                            ["Edit option 2", edit_function]]])

box = Box(app, layout="grid")
title = Text(box, text=f"", size=14, font="Arial", grid=[1, 0])
app.display()
Ejemplo n.º 27
0
qualities = '360p'
display_width = 500

app = App(title="Youtube-dl", width=display_width, height=600)


def dest_function():
    print('LOL')


def about_function():
    print("LOL")


menubar = MenuBar(app,
                  toplevel=["Download", "About"],
                  options=[[["Select a download location", dest_function]],
                           [["About Youtube-dl", about_function]]])
#main_window = Window(app, title="Youtube-dl")
"""
https://www.youtube.com/watch?v=uLls8mRFhZQ
"""


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))
Ejemplo n.º 28
0
## Experiment Progres Window

progress_Win = Window(gui,
                      height=300,
                      width=500,
                      title="Experiment Progress",
                      visible=0)
progressBox = Box(progress_Win)
abort_exp_button = PushButton(progressBox,
                              text="Abort Experiment",
                              command=ABORT_Experiment)
time_remaining_str = Text(progressBox, text="Estimated Time Remaining ")
time_remain_text = Text(progressBox)
volume_remaining_str = Text(progressBox, text="Volume Remaining ")
volume_remain_text = Text(progressBox)
logBox = Box(gui, enabled=0)
flowrate_str = Text(progressBox, text="Flow Rate is ")
flowrate_text = Text(progressBox)

## Finished win
finished_Win = Window(gui, title="Operation Complete", visible=0)

## MenuBar Widigets
File_options = [["Prepare Experiment", select_gas], ["Exit", ask_to_close]]
DataLog_options = [["Open Log", enable_Log]]

menuBar = MenuBar(gui, ["File", "DataLog"], [File_options, DataLog_options])

gui.display()

def do_jobButtonGroup():
    jobTitleLabel.value = jobButtonGroup.value_text


def do_okPushButton():
    info("Information", "Thank you!")


def do_closePushButton():
    if yesno("Exit?", "Exit program?") == True:
        app.destroy()


menubar = MenuBar(app, toplevel=["File"], options=[[["Exit", exit_function]]])

# Layout the app controls
firstNameLabel = Text(app,
                      text="First Name",
                      grid=[0, 0],
                      align="left",
                      size=10)
lastNameLabel = Text(app, text="Last Name", grid=[0, 1], align="left", size=10)
countryLabel = Text(app, text="Country", grid=[0, 2], align="left", size=10)
addressLabel = Text(app, text="Address", grid=[0, 3], align="left", size=10)

firstNameText = TextBox(app, width=25, grid=[1, 0])
lastNameText = TextBox(app, width=25, grid=[1, 1])
countryCombo = Combo(app,
                     options=['United Kingdom', 'United States', 'France'],
Ejemplo n.º 30
0
# MENU

from guizero import App, MenuBar


def file_function():
    print("File option")


def edit_function():
    print("Edit option")


app = App()
menubar = MenuBar(app,
                  toplevel=["File", "Edit"],
                  options=[[["File option 1", file_function],
                            ["File option 2", file_function],
                            ["File option 1", file_function],
                            ["File option 2", file_function]],
                           [["Edit option 1", edit_function],
                            ["Edit option 2", edit_function]]])
app.display()