Example #1
0
 ],
 [
     sg.Frame(layout=[
         [
             sg.Text('Number of neurons in FC layer:',
                     size=(model_frame_text_len, 1)),
             sg.Slider(default_value=500,
                       range=(100, 1000),
                       size=(60, 20),
                       orientation='h',
                       key='neuron_slider')
         ],
         [
             sg.Text('activate dropout:',
                     size=(model_frame_text_len, 1)),
             sg.Checkbox('', key='dropout')
         ],
         [
             sg.Text('Batch Size:', size=(model_frame_text_len, 1)),
             sg.Slider(default_value=32,
                       range=(32, 500),
                       resolution=1,
                       size=(60, 20),
                       orientation='h',
                       key='batch_slider')
         ],
         [
             sg.Text('Learning Rate:',
                     size=(model_frame_text_len, 1)),
             sg.Slider(default_value=0.01,
                       range=(0, 10),
Example #2
0
def create_window():
    '''
    Events and Values
        3 Possible Events
            1.Submit data to be written to file
            2.Cancel -> exits the program
            3.Plot -> Plots previous data
            4.Print Report -> Prints values in interpreter (eventually export report)
            
        Values:
            Key Value Pairs
                0:Mood Score
                1:Hours of Sleep
                2:Exercise
                3:House Cleanliness
                4:Alcohol Use
                5:SI
                :Journal Entry
            
            
    '''
    sg.theme('SandyBeach')

    msymptoms = [[sg.Text("Manic Symptoms:")],
                 [sg.Checkbox("Incresed Energy", default=False)],
                 [sg.Checkbox("Euphoria", default=False)],
                 [sg.Checkbox("Decresed Need for Sleep", default=False)],
                 [
                     sg.Checkbox("Racing Thoughts/Distractibility",
                                 default=False)
                 ], [sg.Checkbox("Overly Talkative", default=False)],
                 [sg.Checkbox("Risky Decisions", default=False)]]

    dsymptoms = [[sg.Text("Depression Symptoms")],
                 [sg.Checkbox("Loss on Interes/Pleasure", default=False)],
                 [sg.Checkbox("Fatigue", default=False)],
                 [sg.Checkbox("Insomnia or Hypersomnia", default=False)],
                 [sg.Checkbox("Cognitive Difficulty", default=False)],
                 [sg.Checkbox("Suicidal Ideation", default=False)],
                 [sg.Checkbox("Agitation or Leaden Feeling", default=False)]]

    layout = [
        [
            sg.Text("Mood Tracker v1.0",
                    size=(30, 1),
                    justification='center',
                    font=('Arial', 20))
        ],
        [sg.Text("Survey:")],
        [
            sg.Text("1.What is the mood today?"),
            sg.Radio(text="Euthymic", default=False, group_id='Radio1'),
            sg.Radio(text="Depressed", default=False, group_id='Radio1')
        ],
        [
            sg.Text("2.How many hours of sleep did you get last night?"),
            sg.Spin(values=np.linspace(0, 24, 49),
                    initial_value=8.0,
                    size=(5, 1))
        ],
        [
            sg.Text("3.Did you exercise today?"),
            sg.Radio('Yes', 'Radio2'),
            sg.Radio('No', 'Radio2')
        ],
        [
            sg.Text("4.Is the house clean?"),
            sg.Radio('Yes', 'Radio3'),
            sg.Radio('No', 'Radio3')
        ],
        [
            sg.Text("5.Did you drink alcohol today?"),
            sg.Radio('Yes', 'Radio4'),
            sg.Radio('No', 'Radio4')
        ],
        [
            sg.Text("6.Did you have Suicidal Ideation Today"),
            sg.Radio('Yes', 'Radio5'),
            sg.Radio('No', 'Radio5')
        ],
        [sg.Text('_' * 80)],
        [
            sg.Frame(title="Symptom Checklist",
                     layout=[[sg.Column(msymptoms),
                              sg.Column(dsymptoms)]])
        ],
        [sg.Text('_' * 80)],
        [
            sg.Text("General Comments"),
            sg.Multiline(default_text='', size=(50, 3))
        ],
        [
            sg.Submit(button_text='Submit'),
            sg.Button("Plot"),
            sg.Button("Print Report"),
            sg.Cancel()
        ],
    ]

    window = sg.Window("mqq4",
                       layout,
                       default_element_size=(40, 1),
                       grab_anywhere=False)
    return (window)
    def filePromptMain(self):
        # Components of the file prompter.
        filePromptMain = [[sg.Text("Select an input file to open")],
                          [
                              sg.In(key="file-path", enable_events=True),
                              sg.FolderBrowse()
                          ],
                          [
                              sg.Text("Width: "),
                              sg.Input(key="width",
                                       size=(10, 1),
                                       default_text="500",
                                       enable_events=True),
                              sg.Text("Height: "),
                              sg.Input(key="height",
                                       size=(10, 1),
                                       default_text="500",
                                       enable_events=True)
                          ],
                          [
                              sg.Text("Frame duration (in seconds): "),
                              sg.Input(key="frame-length",
                                       size=(10, 1),
                                       default_text="0.005",
                                       enable_events=True)
                          ],
                          [
                              sg.Checkbox("Loop animation: ",
                                          key="loop-mode",
                                          default=False,
                                          enable_events=True)
                          ], [sg.Open(key="submit"),
                              sg.Cancel()]]
        filePrompt = sg.Window(title="Select points file",
                               layout=filePromptMain)

        while True:
            isSuccess = True
            event, values = filePrompt.read()

            # Close the prompt if the user closes it.
            if event in (sg.WIN_CLOSED, "Exit", "Cancel"):
                break

            filePath = values["file-path"]
            width = values["width"]
            height = values["height"]
            frameLength = values["frame-length"]
            loopMode = values["loop-mode"]

            # Handle the submit event and form validation.
            if event == "submit":
                # Check if the path exists.
                if filePath and path.exists(filePath) and path.isdir(filePath):
                    data = self.loadPoints(filePath)
                else:
                    # Print an error if the file doesn't exist.
                    sg.popup_quick_message(
                        "Bad path", f"The path \"{filePath}\" is not a valid")
                    isSuccess = False

                # Handle width
                if width:
                    try:
                        width = int(width)
                    except:
                        # Print an error width parsing failed.
                        sg.popup_quick_message(
                            "Bad width",
                            f"The width must be a valid whole number. \"{width}\" is not valid."
                        )
                        isSuccess = False
                else:
                    # Print an error if the width.
                    sg.popup_quick_message(
                        "No width", "A width in pixels needs to be entered.")
                    isSuccess = False

                # Handle height
                if height:
                    try:
                        height = int(height)
                    except:
                        # Print an error height parsing failed.
                        sg.popup_quick_message(
                            "Bad height",
                            f"The height must be a valid whole number. \"{height}\" is not valid."
                        )
                        isSuccess = False
                else:
                    # Print an error if the height.
                    sg.popup_quick_message(
                        "No height", "A height in pixels needs to be entered.")
                    isSuccess = False

                # Handle frame length
                if frameLength:
                    try:
                        frameLength = float(frameLength)
                    except:
                        # Print an error frameLength parsing failed.
                        sg.popup_quick_message(
                            "Bad frame duration",
                            f"The frame must be a valid number number. \"{frameLength}\" is not valid."
                        )
                        isSuccess = False
                else:
                    # Print an error if the frameLength is not entered.
                    sg.popup_quick_message(
                        "No frame duration",
                        "A frame length in seconds needs to be entered.")
                    isSuccess = False

                # If validation was successful, continue.
                if isSuccess:
                    filePrompt.close()

                    return data, width, height, frameLength, loopMode, filePath
                else:
                    isSuccess = True
Example #4
0
import numpy as np
import wave
import soundfile as sf
import os
import math
#import getEASDA14header.py
import PySimpleGUI as sg

layout = [
    [sg.Text('Папка с исходными файлами (.wav, отсчёты с рекордера)'), sg.InputText('D:/MATLAB/V_Pa_Converter/src'), sg.FolderBrowse()],
    [sg.Text('Папка, куда положить результат (.wav, Па)                       '), sg.InputText('D:/MATLAB/V_Pa_Converter/res'), sg.FolderBrowse()],
    [sg.Checkbox('Записи сделаны в режиме low power')],
    [sg.Output(size=(84, 10)),sg.Submit('Конвертировать',size=(14,10))]
]
window = sg.Window('Конвертер записей с EA-SDA14 в Паскали', layout)
while True:                             # The Event Loop
    event, values = window.read()
    srcFolder = values[0]
    resFolder = values[1]
    lowPower  = values[2]
    sensdB = -154.5
    os.chdir(srcFolder)
    srcFiles = os.listdir(srcFolder)
    print('Число найденных файлов в папке: ',len(srcFiles))
    resFiles = os.listdir(resFolder)

    for idx,file in enumerate(srcFiles):
        print('В обработке файл №',idx+1,'из ',len(srcFiles))
        wav = wave.open(file, mode="r")
        (nchannels, sampwidth, framerate, nframes, comptype, compname) = wav.getparams()
        content = wav.readframes(nframes)
Example #5
0
    ],
    [
        sg.Text('- Local rotation columns:', size=(20, 1)),
        sg.InputText('TRDIPDIR', key='AZ', size=(10, 1)),
        sg.InputText('TRDIP', key='DP', size=(10, 1)),
        sg.InputText('RAKE', key='RK', size=(10, 1))
    ],
    [
        sg.Text('- Coordinate columns:', size=(20, 1)),
        sg.InputText('XPT', key='X2', size=(10, 1)),
        sg.InputText('YPT', key='Y2', size=(10, 1)),
        sg.InputText('ZPT', key='Z2', size=(10, 1))
    ],
    [
        sg.Text('- Invert dip sign*:', size=(20, 1)),
        sg.Checkbox(' ', key='neg_dip', default=False)
    ],
    [
        sg.Text(
            '* The script convention assumes GSLIB rotation, where negative dip points down',
            font='Default 9')
    ], [sg.Text(' ')],
    [
        sg.Text('Output datafile:', size=(20, 1)),
        sg.InputText('dataset_angs', key='OUT')
    ], [sg.Text(' ')], [sg.Button('Run'), sg.Button('Close')], [sg.Text(' ')]
]

window = sg.Window('Angs to Datafile', layout)

while True:
def AllWidgetsNoContext():
    """
    All Widgets No Context Manager
    """
    import PySimpleGUI as sg

    sg.ChangeLookAndFeel('GreenTan')

    form = sg.FlexForm('Everything bagel',
                       default_element_size=(40, 1),
                       grab_anywhere=False)

    column1 = [
        [
            sg.Text('Column 1',
                    background_color='#F7F3EC',
                    justification='center',
                    size=(10, 1))
        ],
        [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')],
        [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')],
        [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]
    ]

    layout = [
        [
            sg.Text('All graphic widgets in one form!',
                    size=(30, 1),
                    font=("Helvetica", 25))
        ], [sg.Text('Here is some text.... and a place to enter text')],
        [sg.InputText('This is my text')],
        [
            sg.Checkbox('Checkbox'),
            sg.Checkbox('My second checkbox!', default=True)
        ],
        [
            sg.Radio('My first Radio!     ', "RADIO1", default=True),
            sg.Radio('My second Radio!', "RADIO1")
        ],
        [
            sg.Multiline(
                default_text=
                'This is the default Text should you decide not to type anything',
                size=(35, 3)),
            sg.Multiline(default_text='A second multi-line', size=(35, 3))
        ],
        [
            sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)),
            sg.Slider(range=(1, 100),
                      orientation='h',
                      size=(34, 20),
                      default_value=85)
        ],
        [
            sg.InputOptionMenu(
                ('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))
        ],
        [
            sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'),
                       size=(30, 3)),
            sg.Slider(range=(1, 100),
                      orientation='v',
                      size=(5, 20),
                      default_value=25),
            sg.Slider(range=(1, 100),
                      orientation='v',
                      size=(5, 20),
                      default_value=75),
            sg.Slider(range=(1, 100),
                      orientation='v',
                      size=(5, 20),
                      default_value=10),
            sg.Column(column1, background_color='#F7F3EC')
        ], [sg.Text('_' * 80)], [sg.Text('Choose A Folder', size=(35, 1))],
        [
            sg.Text('Your Folder',
                    size=(15, 1),
                    auto_size_text=False,
                    justification='right'),
            sg.InputText('Default Folder'),
            sg.FolderBrowse()
        ], [sg.Submit(), sg.Cancel()]
    ]

    button, values = form.LayoutAndRead(layout)
Example #7
0
                           default_text=sfb.InitialFolder), sfb
          ],
          [
              sg.Text('Destination for search result XLSX files',
                      size=(30, 1)),
              sg.InputText(key='-DFOLDER-',
                           size=(100, 1),
                           default_text=dfb.InitialFolder), dfb
          ],
          [
              sg.Text('Search keyword', size=(30, 1)),
              sg.InputText('', size=(100, 1), key='-KEYWORD-')
          ],
          [
              sg.Checkbox('Mark results with __XX__',
                          key='-CB-',
                          size=(20, 1),
                          default=True)
          ], [sg.Text('', size=(100, 1))], [sg.Submit()],
          [sg.Text('', size=(100, 1))], [status[0]], [status[1]], [status[2]]]

w = sg.Window("xlsxsearch", layout, margins=(80, 50))

folder = ''
while True:
    folder = "."
    file_list = []
    event, values = w.read()
    # End program if user closes window or
    # presses the OK button
    if event == "Submit":
        fix_search = values["-CB-"]
Example #8
0
import PySimpleGUI as sg

sg.change_look_and_feel('Dark Blue 3')

# class hockeyCard:

layout = [[sg.Text('Name'), sg.InputText()], [sg.Text('Team'),
                                              sg.InputText()],
          [
              sg.Checkbox('Rookie'),
              sg.Checkbox('Memorobilia'),
              sg.Checkbox('Autograph'),
              sg.Checkbox('S/N')
          ], [sg.Text('Run Number'), sg.InputText()],
          [
              sg.Text('Year'),
              sg.InputText(),
          ], [sg.Submit(), sg.Cancel()],
          [sg.Text('Price'),
           sg.Output(size=(10, 10), pad=(5, 5))]]

window = sg.Window('Hockey_Card', layout)

while True:  # The Event Loop
    event, values = window.read()
    print(event, values)  #debug
    if event in (None, 'Exit', 'Cancel'):
        break
        """name, team, rookie Y/N, memorabilia Y/N, autographed Y/N, serial Y/N and then the ML model outputs the price variable. Is that about right @Michael Middleton ? (edited) 
Michael Middleton 7:41 PM
Yea and now the run number qnd year as well"""
Example #9
0
     sg.InputText(key="output gne", size=(34, 1)),
     sg.FileSaveAs(key="output gne")
 ],
 [sg.Text("Output file for the summary table.", size=(TEXT_WIDTH, 1))],
 [
     TextLabel("Delimiter"),
     sg.InputText(key="delimiter gne", size=(34, 1))
 ],
 [
     sg.Text(
         "Character used to delimit values in the summary table. If no delimiter"
         " is specified, the table will be generated in human-readable format.",
         size=(TEXT_WIDTH, 2))
 ],
 [TextLabel("Hide headers"),
  sg.Checkbox("", key="hide headers gne")],
 [
     sg.Text(
         "Hide all headers in the summary table. This includes organism and scaffold"
         " headers, as well as headers in the hit table.",
         size=(TEXT_WIDTH, 2))
 ],
 [
     TextLabel("Decimal places"),
     sg.Spin(list(range(6)), initial_value=2, key="decimals gne")
 ],
 [
     TextLabel("Plot"),
     sg.InputText(key="plot gne", size=(34, 1)),
     sg.FileSaveAs(key="plot gne")
 ],
Example #10
0
def main():

    # ---------------------------- setup window "feel" --------------------------- #

    sg.ChangeLookAndFeel('Dark2')
    sg.SetOptions(font=(
        'calibri',
        12,
    ), element_padding=(1, 1))

    # ------------------------- get pathname for logo file ----------------------- #

    dirname, filename = os.path.split(os.path.abspath(__file__))
    pathname = os.path.join(dirname, 'logo.png')

    # ------------------------------ Menu Definition ----------------------------- #

    menu_def = [
        [
            'File',
            [
                'Setup Connection::_SETUP_',
                'Terminate Connection::_TERMINATE_', 'Save', 'Exit'
            ]
        ],
        [
            'Edit',
            ['Paste', [
                'Special',
                'Normal',
            ], 'Undo'],
        ],
        ['Help', ['Users Guide', 'About...']],
    ]

    # ---------------------------------------------------------------------------- #
    #                                 GUI Defintion                                #
    # ---------------------------------------------------------------------------- #

    # --------------------- define columns to be used in tabs -------------------- #

    comlist = [
        '-------', 'COM1', 'COM2', 'COM3', 'COM4', 'COM5', 'COM6', 'COM7',
        'COM8', 'COM9', 'COM10', 'COM11', 'COM12', 'COM13', 'COM14', 'COM15'
    ]

    cold1_frame_layout = [
        [sg.Output(size=(65, 30), key='_SETUPOUTPUT_', font='Courier 8')],
        #sg.DropDown(comlist, default_value='COM7',enable_events=True, key='_LISTBOX_')],
        [
            sg.Button('Check COM Ports', pad=(5, 2), bind_return_key=False),
            sg.Button('Configure COM Port',
                      pad=(5, 2),
                      bind_return_key=False,
                      button_color=('white', 'green')),
            sg.DropDown(comlist,
                        size=(10, 1),
                        enable_events=True,
                        readonly=True,
                        key='_LISTBOX_')
        ]
    ]

    cold1 = [[
        sg.Frame('Setup',
                 layout=cold1_frame_layout,
                 relief=sg.RELIEF_RAISED,
                 element_justification='justified')
    ]]

    cold2_frame_layout = [[
        sg.Text('Firefighter #', justification='center'),
        sg.Text('Heart Rate', justification='center'),
        sg.Text('Movement', justification='center'),
        sg.Text('Temperature', justification='center')
    ],
                          [
                              sg.Text('Firefighter 1: ', justification='left'),
                              LEDIndicator('_TABDEFAULTFF1HRLED_'),
                              sg.Text(' '),
                              LEDIndicator('_TABDEFAULTFF1MOVLED_'),
                              sg.Text(' '),
                              LEDIndicator('_TABDEFAULTFF1TEMPLED_')
                          ],
                          [
                              sg.Text('Firefighter 2: ', justification='left'),
                              LEDIndicator('_TABDEFAULTFF2HRLED_'),
                              sg.Text(' '),
                              LEDIndicator('_TABDEFAULTFF2MOVLED_'),
                              sg.Text(' '),
                              LEDIndicator('_TABDEFAULTFF2TEMPLED_')
                          ],
                          [
                              sg.Text('Firefighter 3: ', justification='left'),
                              LEDIndicator('_TABDEFAULTFF3HRLED_'),
                              sg.Text(' '),
                              LEDIndicator('_TABDEFAULTFF3MOVLED_'),
                              sg.Text(' '),
                              LEDIndicator('_TABDEFAULTFF3TEMPLED_')
                          ],
                          [
                              sg.Button('Update All',
                                        pad=(5, 2),
                                        key='_UPDATEALL_'),
                              sg.Button('Stop Updates',
                                        pad=(5, 2),
                                        key='_TABDEFAULTSTOPUP_'),
                              sg.Checkbox('Enable PopUps',
                                          default=True,
                                          enable_events=True,
                                          key='_TOGGLEPOPUPALL_')
                          ]]

    cold2 = [[
        sg.Frame('Firefighter Status',
                 cold2_frame_layout,
                 relief=sg.RELIEF_RAISED,
                 element_justification='justified')
    ]]

    cola1_frame_layout = [[
        sg.Text("Heart Rate", font=('calibri', 12), justification='right'),
        LEDIndicator('_FF1HRLED_'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_HRTEXT1_'),
        sg.Text('Max Recorded HR:', justification='right'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_MAXHRTEXT1_'),
        sg.Button('FF1 RAW Heart Rate', key='_RAWHR1_')
    ]]

    cola1 = [[
        sg.Frame('Heart Rate',
                 cola1_frame_layout,
                 element_justification='center')
    ]]

    cola2_frame_layout = [[
        sg.Text('Movement', font=('calibri', 12), justification='right'),
        LEDIndicator('_FF1MOVLED_'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_MOVTEXT1_'),
        sg.Text('Movement Warnings:', justification='right'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_MOVWARN1_'),
        sg.Button('FF1 RAW Movement', key='_RAWMOV1_')
    ]]

    cola2 = [[sg.Frame('Movement', cola2_frame_layout)]]

    cola3_frame_layout = [[
        sg.Text('Temperature', font=('calibri', 12), justification='right'),
        LEDIndicator('_FF1TEMPLED_'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_TEMPTEXT1_'),
        sg.Text('Temperature Warnings:', justification='right'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_TEMPWARN1_'),
        sg.Button('FF1 RAW Temperature', key='_RAWTEMP1_')
    ]]

    cola3 = [[sg.Frame('Temperature', cola3_frame_layout)]]

    colb1_frame_layout = [[
        sg.Text("Heart Rate",
                font=('calibri', 12, 'bold'),
                justification='right'),
        LEDIndicator('_FF2HRLED_'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_HRTEXT2_'),
        sg.Text('Max Recorded HR:', justification='right'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_MAXHRTEXT2_'),
        sg.ReadButton('FF2 RAW Heart Rate', key='_RAWHR2_')
    ]]

    colb1 = [[sg.Frame('Heart Rate', colb1_frame_layout)]]

    colb2_frame_layout = [[
        sg.Text('Movement', font=('calibri', 12), justification='right'),
        LEDIndicator('_FF2MOVLED_'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_MOVTEXT2_'),
        sg.Text('Movement Warnings:', justification='right'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_MOVWARN2_'),
        sg.Button('FF2 RAW Movement', key='_RAWMOV2_')
    ]]

    colb2 = [[sg.Frame('Movement', colb2_frame_layout)]]

    colb3_frame_layout = [[
        sg.Text('Temperature', font=('calibri', 12), justification='right'),
        LEDIndicator('_FF2TEMPLED_'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_TEMPTEXT2_'),
        sg.Text('Temperature Warnings:', justification='right'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_TEMPWARN2_'),
        sg.Button('FF2 RAW Temp', key='_RAWTEMP2_')
    ]]

    colb3 = [[sg.Frame('Temperature', colb3_frame_layout)]]

    colc1_frame_layout = [[
        sg.Text("Heart Rate", font=('calibri', 12), justification='right'),
        LEDIndicator('_FF3HRLED_'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_HRTEXT3_'),
        sg.Text('Max Recorded HR:', justification='right'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_MAXHRTEXT3_'),
        sg.ReadButton('FF3 RAW Heart Rate', key='_RAWHR3_')
    ]]

    colc1 = [[sg.Frame('Heart Rate', colc1_frame_layout)]]

    colc2_frame_layout = [[
        sg.Text('Movement', font=('calibri', 12), justification='right'),
        LEDIndicator('_FF3MOVLED_'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_MOVTEXT3_'),
        sg.Text('Movement Warnings:', justification='right'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_MOVWARN3_'),
        sg.Button('FF3 RAW Movement', key='_RAWMOV3_')
    ]]

    colc2 = [[sg.Frame('Movement', colc2_frame_layout)]]

    colc3_frame_layout = [[
        sg.Text('Temperature', font=('calibri', 12), justification='right'),
        LEDIndicator('_FF3TEMPLED_'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_TEMPTEXT3_'),
        sg.Text('Temperature Warnings:', justification='right'),
        sg.Multiline(font=('calibri', 15, 'bold'),
                     disabled=True,
                     key='_TEMPWARN3_'),
        sg.Button('FF3 RAW Temp', key='_RAWTEMP3_')
    ]]

    colc3 = [[sg.Frame('Temperature', colc3_frame_layout)]]

    # ---------------------------- define tab layouts ---------------------------- #

    tabdefault_layout = [[
        sg.Text('Welcome to the SFSS!',
                size=(45, 1),
                justification='center',
                font=('calibri', 25, 'bold'))
    ],
                         [
                             sg.Text('Use the tabs above to navigate...',
                                     size=(45, 1),
                                     justification='center',
                                     font=('calibri', 15))
                         ], [sg.Column(cold1),
                             sg.Column(cold2)]]

    tab1_layout = [[sg.Text('Firefighter 1', font=('calibri', 15, 'bold'))],
                   [
                       sg.Column(cola1,
                                 justification='center',
                                 element_justification='center')
                   ],
                   [
                       sg.Column(cola2,
                                 justification='center',
                                 element_justification='center')
                   ],
                   [
                       sg.Column(cola3,
                                 justification='center',
                                 element_justification='center')
                   ],
                   [
                       sg.Button('Update', key='_UPDATETAB1_'),
                       sg.Button('Stop Updates', key='_STOPUPTAB1_'),
                       sg.Button('Show Graph', key='_HRGRAPH1_')
                   ]]

    tab2_layout = [[sg.Text('Firefighter 2', font=('calibri', 15, 'bold'))],
                   [
                       sg.Column(colb1,
                                 justification='center',
                                 element_justification='center')
                   ],
                   [
                       sg.Column(colb2,
                                 justification='center',
                                 element_justification='center')
                   ],
                   [
                       sg.Column(colb3,
                                 justification='center',
                                 element_justification='center')
                   ],
                   [
                       sg.Button('Update', key='_UPDATETAB2_'),
                       sg.Button('Stop Updates', key='_STOPUPTAB2_'),
                       sg.Button('Show Graph', key='_HRGRAPH2_')
                   ]]

    tab3_layout = [[sg.Text('Firefighter 3', font=('calibri', 15, 'bold'))],
                   [
                       sg.Column(colc1,
                                 justification='center',
                                 element_justification='center')
                   ],
                   [
                       sg.Column(colc2,
                                 justification='center',
                                 element_justification='center')
                   ],
                   [
                       sg.Column(colc3,
                                 justification='center',
                                 element_justification='center')
                   ],
                   [
                       sg.Button('Update', key='_UPDATETAB3_'),
                       sg.Button('Stop Updates', key='_STOPUPTAB12'),
                       sg.Button('Show Graph', key='_HRGRAPH3_')
                   ]]

    # ------------------------------- window layout ------------------------------ #

    layout = [[sg.Menu(menu_def, tearoff=False)],
              [
                  sg.TabGroup([[
                      sg.Tab('Welcome', tabdefault_layout),
                      sg.Tab('Firefighter 1', tab1_layout),
                      sg.Tab('Firefighter 2', tab2_layout),
                      sg.Tab('Firefighter 3', tab3_layout)
                  ]],
                              key='_TABGROUP_',
                              title_color='Black')
              ]]

    window = sg.Window("Smart Firefighter Support System",
                       default_element_size=(20, 5),
                       auto_size_text=False,
                       auto_size_buttons=True,
                       element_padding=(2, 2),
                       grab_anywhere=False,
                       default_button_element_size=(5, 1),
                       resizable=True,
                       element_justification='center',
                       finalize=True).Layout(layout)

    # -------------------------------- EVENT LOOP -------------------------------- #

    while True:
        event, values = window.Read()
        if event in (None, 'Exit'):
            break


# ----------------------------------- Menu ----------------------------------- #

        if event == 'About...':
            sg.Popup('About this program', 'Version 0.1a',
                     'Smart Firefighter Support System (SFSS)', 'Robert Wells',
                     'Kris Perales', 'Jonathan Naranjo (PM)',
                     'Summer Abdullah')
        if event == 'Users Guide':
            # ----------- Subprocess to launch browser and take to SFSS github ----------- #
            CHROME = r"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
            FIREFOX = r"C:\Program Files\Mozilla Firefox\firefox.exe"
            github = "https://github.com/sfss-rw/sfss/"
            layout = [[
                sg.Text('GUIDE: https://github.com/sfss-rw/sfss/',
                        key='_TEXT_')
            ],
                      [
                          sg.Input('https://github.com/sfss-rw/sfss/',
                                   do_not_clear=True,
                                   key='_URL_')
                      ],
                      [
                          sg.Button('Default',
                                    bind_return_key=True,
                                    focus=True),
                          sg.Button('Chrome'),
                          sg.Button('Firefox')
                      ]]
            windowguide = sg.Window("github: User's Guide", layout)
            while True:  # Event Loop
                event, values = windowguide.Read()
                if event in (None, 'Exit'):
                    break
                if event == 'Chrome':
                    sp1 = subprocess.Popen([CHROME, values['_URL_']],
                                           shell=True,
                                           stdout=subprocess.PIPE,
                                           stderr=subprocess.PIPE)
                if event == 'Firefox':
                    sp2 = subprocess.Popen([FIREFOX, values['_URL_']],
                                           shell=True,
                                           stdout=subprocess.PIPE,
                                           stderr=subprocess.PIPE)
                # --------------- Use import webbrowser to open default browser --------------- #
                if event == 'Default':
                    webbrowser.open_new(github)
        elif event == 'Open':
            filename = sg.PopupGetFile('file to open', no_window=True)
            print(filename)
Example #11
0
import PySimpleGUI as sg

# Tema
sg.theme('DarkBlue3')

layout = [[sg.Text('Digite um Site')], [sg.Input(key='campo_site')],
          [sg.Text('Fazer pesquisas em quais sites?')],
          [
              sg.Checkbox('Google', key='google'),
              sg.Checkbox('Yahoo', key='yahoo'),
              sg.Checkbox('Bing', key='bing')
          ], [sg.Text('Pode rodar o programa de madrugada?')],
          [
              sg.Radio('Sim', group_id='horario_execucao', key='sim'),
              sg.Radio('Não', group_id='horario_execucao', key='nao')
          ], [sg.Text('Quantas mensagens por dia')],
          [
              sg.Slider(range=(1, 10),
                        default_value=1,
                        orientation='h',
                        key='mensagens_dia')
          ], [sg.Button('Enviar dados')]]

janela = sg.Window('CheckBoxes RadioButton Slider', layout=layout)

while True:
    evento, valores = janela.Read()
    if evento == sg.WINDOW_CLOSED:
        break

    if evento == 'Enviar dados':
Example #12
0
    def params_menu(self, task, is_task=True):
        params = task.get_params()
        params_col = []
        for key, value in params.items():
            if value == 'y':
                params_col.append([
                    sg.Text(key, size=(25, 1)),
                    sg.Checkbox('', key=key, default=True)
                ])
            elif value == 'n':
                params_col.append([
                    sg.Text(key, size=(25, 1)),
                    sg.Checkbox('', key=key, default=False)
                ])
            else:
                params_col.append(
                    [sg.Text(key, size=(25, 1)),
                     sg.InputText(value, key=key)])

        layout = [
            [sg.Column(params_col)],
            [sg.Button("Back to Main Menu"),
             sg.Button("Confirm Parameters")],
        ]

        if is_task:
            layout.append([
                sg.Text(
                    "Note: You must \'Confirm Parameters\' before starting task."
                )
            ])
            start_button = sg.Button("Start Task", disabled=True, key="ST")
            layout[1].append(start_button)

            if task.name == "Social Stimuli as Rewards":
                layout.insert(1, [sg.Button("Open Stimuli", key="SS")])
        else:
            layout.insert(
                0,
                [sg.Text("Detected screen Size: " + self.get_screen_size())])
            layout.append([
                sg.Text(
                    "Note: The screen size affects the tasks, not this GUI.")
            ])

        params_window = sg.Window(task.name + " Parameters",
                                  layout,
                                  margins=self.size,
                                  font=self.font)
        while True:
            event, values = params_window.read()

            if event == "Back to Main Menu" or event == sg.WIN_CLOSED:
                break
            elif event == "Confirm Parameters":
                for key, value in values.items():
                    if isinstance(value, bool):
                        if value:
                            values[key] = 'y'
                        else:
                            values[key] = 'n'
                            if key == "touchscreen_mode":
                                subprocess.Popen(['qjoypad "gamepad"'],
                                                 shell=True)
                    elif key == "retention_interval_lengths":
                        try:
                            assert (list(map(int, value.split(","))))
                        except ValueError:
                            sg.Popup(
                                "Parameter Error: Please separate multiple variables with a ','",
                                font=self.font)
                    elif "name" not in key:
                        try:
                            assert (int(value))
                        except ValueError:
                            sg.Popup(
                                "Parameter Error: For the non-naming parameters, please input integer numbers only.",
                                font=self.font)
                task.set_params(values)
                try:
                    start_button.update(disabled=False)
                except UnboundLocalError:
                    pass
            elif event == "ST":
                if task.start_task():
                    sg.Popup("Task Completed.", font=self.font)
            elif event == "SS":
                subprocess.run([
                    "pcmanfm",
                    "/home/pi/Desktop/ChimpPygames/Social_Stimuli_As_Rewards/Social_Stimuli"
                ])

        params_window.close()
Example #13
0
layout = [
    [sg.Text('MKVTools', justification='center', font=("Helvetica", 25))],
    [sg.Text('IMDB Code', size=(13, 1)),
     sg.InputText()],
    [
        sg.Text('Season Start', size=(13, 1)),
        sg.InputText(size=(15, 1)),
        sg.Text('Season End'),
        sg.InputText(size=(16, 1))
    ],
    [sg.Text('Episode Directory', size=(13, 1)),
     sg.InputText()],
    [sg.Text('Subtitle Directory', size=(13, 1)),
     sg.InputText()],
    [
        sg.Checkbox('Rename Tags', default=False, size=(31, 1)),
        sg.Button('Rename', size=(8, 1)),
        sg.Button('Cancel', size=(8, 1))
    ],
]

window = sg.Window('MKVTools', layout)

while True:
    event, values = window.read()
    if event in (sg.WIN_CLOSED, 'Cancel'):
        break

    code = values[0]

    start = int(start) if values[1] != '' else 0
Example #14
0
    def make_window(self,
                    caption,
                    gui_left_upper,
                    gui_right_upper=None,
                    clear=None,
                    bounce=True,
                    fps=None):
        """
        Create the window, including sg.Graph, the drawing surface.
        """
        # --------------------- PySimpleGUI window layout and creation --------------------
        clear_line = [] if clear is None else \
                     [sg.Checkbox('Clear before setup?', key='Clear?', default=clear, pad=((0, 0), (10, 0)),
                                  tooltip='Bounce back from the edges of the screen?')]

        (value, visibility) = bounce if isinstance(bounce, tuple) else (bounce,
                                                                        True)
        bounce_checkbox_line = [] if bounce is None else \
                               [sg.Checkbox('Bounce?', key='Bounce?', default=value, pad=((20, 0), (10, 0)),
                                            visible=visibility, tooltip='Bounce back from the edges of the screen?')]

        clear_line += bounce_checkbox_line

        # Always an fps combo box, but make it visible only if the user specifies such a box.
        # The box is necessary to allow the program to set fps even if the end user doesn't
        fps_combo_line = [
            sg.Text('Frames/second',
                    tooltip='The maximum frames/second.',
                    visible=bool(fps),
                    pad=((0, 10), (17, 0))),
            sg.Combo(key=gui.FPS,
                     values=FPS_VALUES,
                     tooltip='The maximum frames/second.',
                     default_value=fps,
                     visible=bool(fps),
                     pad=((0, 0), (17, 0)),
                     enable_events=True)
        ]

        setup_go_line = [
            sg.Button(self.SETUP, pad=((0, 10), (10, 0))),
            sg.Button(gui.GO_ONCE,
                      disabled=True,
                      button_color=('white', 'green'),
                      pad=((0, 10), (10, 0))),
            sg.Button(gui.GO,
                      disabled=True,
                      button_color=('white', 'green'),
                      pad=((0, 30), (10, 0)),
                      key=gui.GOSTOP)
        ]

        exit_button_line = [
            sg.Exit(button_color=('white', 'firebrick4'),
                    key=self.EXIT,
                    pad=((0, 0), (10, 0))),
            sg.Checkbox('Grab anywhere',
                        key='Grab',
                        default=False,
                        pad=((40, 0), (10, 0)))
        ]

        col1 = [
            *gui_left_upper,
            gui.HOR_SEP(), setup_go_line, clear_line, fps_combo_line,
            gui.HOR_SEP(), exit_button_line
        ]

        lower_left_pixel_xy = (0, self.screen_shape_width_height[1] - 1)
        upper_right_pixel_xy = (self.screen_shape_width_height[0] - 1, 0)

        if gui_right_upper is None:
            gui_right_upper = [[]]

        # graph is a drawing area, a screen on which the model is portrayed, i.e., the patches and the agents.
        # It consists mainly of a TKCanvas.
        graph = sg.Graph(self.screen_shape_width_height,
                         lower_left_pixel_xy,
                         upper_right_pixel_xy,
                         background_color='black',
                         key='-GRAPH-',
                         enable_events=True,
                         drag_submits=True)
        col2 = gui_right_upper + [[graph]]

        # layout is the actual layout of the window. The stuff above organizes it into component parts.
        # col1 is the control buttons, sliders, etc.
        # col2 is the graph plus whatever the user wants to put above it.
        # layout is a single "GUI line" with these two components in sequence.
        layout = [[sg.Column(col1), sg.Column(col2)]]

        # window is a window with that layout.
        window = sg.Window(caption,
                           layout,
                           margins=(5, 20),
                           use_default_focus=False,
                           grab_anywhere=False,
                           return_keyboard_events=True,
                           finalize=True)

        # -------------- Magic code to integrate PyGame with tkinter -------
        w_id = graph.TKCanvas.winfo_id()
        os.environ['SDL_WINDOWID'] = str(w_id)
        # os.environ['SDL_VIDEODRIVER'] = 'x11'  # change this to 'x11' to make it work on Linux
        os.environ['SDL_VIDEODRIVER'] = 'windib'

        return window
Example #15
0
layout = [
    [
        Sg.Text("Путь к файлу с адресами:", size=(75, 1)),
        Sg.FileBrowse("Обзор"),
    ],
    [Sg.HSeparator()],
    [Sg.Output(size=(75, 10), echo_stdout_stderr=False)],
    [
        Sg.Text("Добавить прокси (ip:port):"),
        Sg.InputText(do_not_clear=False),
        Sg.Button("Добавить прокси"),
    ],
    [
        Sg.Button("Запуск"),
        Sg.Checkbox("Использовать прокси"),
        Sg.VSeparator(),
        Sg.Button("Очистить файл результатов"),
        Sg.VSeparator(),
        Sg.Button("Выход"),
    ],
]

window = Sg.Window("Yandex Maps scraper", layout)

if __name__ == "__main__":
    while True:
        event, values = window.read()

        if event == "Очистить файл результатов":
            ClearWB()
Example #16
0
import PySimpleGUI as sg

title_col = [
    [sg.Text("Name:", size=(14,1)),
    sg.Text(size=(15,1), key="-ACTIVE_NAME-")]
]

client_viewer_contents = [
    # [sg.Column(title_col)],
    [sg.Text('Status:'), sg.Text('Not Connected', key='_connect_status')],
    [sg.Text('Quality:'), sg.Text('-', size=(30,1), auto_size_text=True, key='_quality')],
    [sg.Text('Rating:'), sg.Text('-', size=(30,1), key='_quality_label')],
    [sg.Text('Skew:'), sg.Text('-', size=(30,1), key='_skew')],
    [sg.Text('Port Offset:'), sg.Text('', size=(30,1), key='_offset')],
    [sg.Text('Channels:'), sg.Text('', size=(30,1), key='_num_ch')],
    [sg.Checkbox('Auto-Manage Connection', default=True, key='_automan_client')],
    [sg.Button('Change Name', key="_change_name")],
    [sg.Button('Change Port', key="_change_port")],
    [sg.Button('Deactivate', key="_change_active", button_color=('black', 'red'))],
    [sg.Button('Remove', key="_remove")],
    #---------ROUTING----------#
    [sg.Text('_'*44)],
    [sg.Text('Audio Routed to Peers', size=(30,1))],
    [sg.Listbox(values=[], enable_events=True, bind_return_key=True, size=(27, 8), 
    font='ANY 14', key="_client_routing")],
    #---------CONSOLE----------#
    [sg.MLine(key='_console_scroll'+sg.WRITE_ONLY_KEY, size=(40,8), autoscroll=True)],
    [sg.Text(size=(40,1), key='_console_line')],


]
Example #17
0
            ['Edit', ['Paste', ['Special', 'Normal', ], 'Undo'], ],      
            ['Help', 'About...'], ]      

# ------ Column Definition ------ #      
column1 = [[sg.Text('Column 1', background_color='#F7F3EC', justification='center', size=(10, 1))],      
            [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 1')],      
            [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 2')],      
            [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3')]]      

layout = [      
    [sg.Menu(menu_def, tearoff=True)],      
    [sg.Text('All graphic widgets in one window!', size=(30, 1), justification='center', font=("Helvetica", 25), relief=sg.RELIEF_RIDGE)],    
    [sg.Text('Here is some text.... and a place to enter text')],      
    [sg.InputText('This is my text')],      
    [sg.Frame(layout=[      
    [sg.Checkbox('Checkbox', size=(10,1)),  sg.Checkbox('My second checkbox!', default=True)],      
    [sg.Radio('My first Radio!     ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')],      
    [sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)),      
        sg.Multiline(default_text='A second multi-line', size=(35, 3))],      
    [sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)),      
        sg.Slider(range=(1, 500), orientation='h', size=(34, 20), default_value=)],      
    [sg.InputOptionMenu(('Menu Option 1', 'Menu Option 2', 'Menu Option 3'))],      
    [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3)),      
        sg.Frame('Labelled Group',[[      
        sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=25),      
        sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=75),      
        sg.Slider(range=(1, 100), orientation='v', size=(5, 20), default_value=10),      
        sg.Column(column1, background_color='#F7F3EC')]])],      
    [sg.Text('_'  * 80)],      
    [sg.Text('Choose A Folder', size=(35, 1))],      
    [sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'),      
Example #18
0
# ---------------------------- Layouts ----------------------------- #
login_layout = [
    input_info('Username', 'lab_username', 'user_login'),
    [
        sg.Text('Password', key='lab_password'),
        sg.Input(key='password_login', password_char='*'),
        sg.Button('Login', key='login_button')
    ]
]

shop_layout = [[
    sg.Text('Sucursal: Ruinas, Cartago', key='lab_shop_name'),
    sg.Text('Saldo: $', key='lab_balamce'),
    sg.Text('123456', key='lab_amount', visible=False)
], [sg.Checkbox('Habilitada', key='cbox_enabled', visible=False)],
               [
                   sg.Button('Salvar', key='btn_save', visible=False),
                   sg.Button('Eliminar', key='btn_delete', visible=False),
                   sg.Button('Transacciones',
                             key='btn_transactions',
                             visible=False)
               ]]

main_layout = [[
    sg.Column(login_layout, size=screen, key='login_frame'),
    sg.Column(shop_layout, size=screen, key='shop_frame', visible=False)
]]

# ------------------------ Window definition ----------------------- #
window = sg.Window('', main_layout, size=screen, font=my_font)
def MachineLearning():
    """
    Machine Learning GUI
    A standard non-blocking GUI with lots of inputs.
    """
    import PySimpleGUI as sg

    sg.ChangeLookAndFeel('LightGreen')

    sg.SetOptions(text_justification='right')

    form = sg.FlexForm('Machine Learning Front End',
                       font=("Helvetica", 12))  # begin with a blank form

    layout = [[
        sg.Text('Machine Learning Command Line Parameters',
                font=('Helvetica', 16))
    ],
              [
                  sg.Text('Passes', size=(15, 1)),
                  sg.Spin(values=[i for i in range(1, 1000)],
                          initial_value=20,
                          size=(6, 1)),
                  sg.Text('Steps', size=(18, 1)),
                  sg.Spin(values=[i for i in range(1, 1000)],
                          initial_value=20,
                          size=(6, 1))
              ],
              [
                  sg.Text('ooa', size=(15, 1)),
                  sg.In(default_text='6', size=(10, 1)),
                  sg.Text('nn', size=(15, 1)),
                  sg.In(default_text='10', size=(10, 1))
              ],
              [
                  sg.Text('q', size=(15, 1)),
                  sg.In(default_text='ff', size=(10, 1)),
                  sg.Text('ngram', size=(15, 1)),
                  sg.In(default_text='5', size=(10, 1))
              ],
              [
                  sg.Text('l', size=(15, 1)),
                  sg.In(default_text='0.4', size=(10, 1)),
                  sg.Text('Layers', size=(15, 1)),
                  sg.Drop(values=('BatchNorm', 'other'), auto_size_text=True)
              ], [sg.Text('_' * 100, size=(65, 1))],
              [sg.Text('Flags', font=('Helvetica', 15), justification='left')],
              [
                  sg.Checkbox('Normalize', size=(12, 1), default=True),
                  sg.Checkbox('Verbose', size=(20, 1))
              ],
              [
                  sg.Checkbox('Cluster', size=(12, 1)),
                  sg.Checkbox('Flush Output', size=(20, 1), default=True)
              ],
              [
                  sg.Checkbox('Write Results', size=(12, 1)),
                  sg.Checkbox('Keep Intermediate Data', size=(20, 1))
              ], [sg.Text('_' * 100, size=(65, 1))],
              [
                  sg.Text('Loss Functions',
                          font=('Helvetica', 15),
                          justification='left')
              ],
              [
                  sg.Radio('Cross-Entropy', 'loss', size=(12, 1)),
                  sg.Radio('Logistic', 'loss', default=True, size=(12, 1))
              ],
              [
                  sg.Radio('Hinge', 'loss', size=(12, 1)),
                  sg.Radio('Huber', 'loss', size=(12, 1))
              ],
              [
                  sg.Radio('Kullerback', 'loss', size=(12, 1)),
                  sg.Radio('MAE(L1)', 'loss', size=(12, 1))
              ],
              [
                  sg.Radio('MSE(L2)', 'loss', size=(12, 1)),
                  sg.Radio('MB(L0)', 'loss', size=(12, 1))
              ], [sg.Submit(), sg.Cancel()]]

    button, values = form.LayoutAndRead(layout)
Example #20
0
        except:
            sg.popup_auto_close('Login Unsuccessfull',
                                title='Error',
                                auto_close_duration=5,
                                no_titlebar=True)
            access_token = ''

with open('config.json') as f:
    config = json.load(f)

checkbox_lo = []
for index in all_sites:
    checkbox_lo.append([
        sg.Checkbox(all_sites[index],
                    key=index,
                    default=config["sites"][str(index)])
    ])

category_lo = []
for index in range(len(all_cat)):
    if index % 3 == 0:
        try:
            category_lo.append([
                sg.Checkbox(all_cat[f"c{index}"],
                            default=config["category"][f"c{index}"],
                            key=f"c{index}",
                            size=(16, 1)),
                sg.Checkbox(all_cat[f"c{index+1}"],
                            default=config["category"][f"c{index+1}"],
                            key=f"c{index+1}",
Example #21
0
layout = [
    [
        sg.InputCombo(tuple(hw_dict[x] for x in hw_dict.keys()),
                      size=(13, 1),
                      key='hw',
                      default_value=hw_dict['460g10'],
                      readonly=True),
        sg.InputCombo(tuple(os_dict[x] for x in os_dict.keys()),
                      size=(16, 1),
                      key='osv',
                      default_value=os_dict['v'],
                      readonly=True)
    ],
    [
        sg.Checkbox('Additional FlexLOM card installed',
                    size=(30, 1),
                    default=False,
                    key='FLOM')
    ],
    [
        sg.Checkbox('Enable auto F9 recognition',
                    size=(30, 1),
                    default=True,
                    key='autof9',
                    tooltip='')
    ],
    [
        sg.Text('Server Name', size=(10, 1)),
        sg.InputText(size=(20, 1), key='srv')
    ],
    # [sg.Text('_'*36,justification='center')],
    [sg.Text('', size=(36, 2), key='output')],
Example #22
0
#Start checking
for profile in need_checking:
    info = []
    i = 0
    driver.get(profile[0])
    #Check if the person is whitelisted or not
    driver.find_element_by_class_name('ipsType_break').click()
    whitelist = driver.find_elements_by_class_name('ipsDataItem_generic')
    #Skip person if he is not whitelisted
    if whitelist[1].text == "NO":
        continue
    driver.get(profile[0])
    #Give popup to see what is good and what is wrong
    layout = [
        [sg.Text('Is the first picture correct?', justification='left')],
        [sg.Checkbox('Yes', size=(12, 1)),
         sg.Checkbox('No', size=(12, 1))],
        [sg.Text('Is the name correct?', justification='left')],
        [sg.Checkbox('Yes', size=(12, 1)),
         sg.Checkbox('No', size=(12, 1))],
        [sg.Text('Is the backstory correct?', justification='left')],
        [
            sg.Checkbox('Yes', size=(12, 1)),
            sg.Checkbox('No', size=(12, 1)),
            sg.Checkbox('WIP', size=(12, 1))
        ], [sg.Ok()]
    ]
    window = sg.Window('Check Page', layout)
    event, values = window.read()
    window.close()
    if values[0] == True:
Example #23
0
            user = ''
            user = r['me']['display_name']
            with open('config.json', 'w') as f:
                json.dump(config, f, indent=4)
            login_window.close()
            break

        except:
            sg.popup_auto_close('Login Unsuccessfull',
                                title='Error',
                                auto_close_duration=5,
                                no_titlebar=True)
            access_token = ''

checkbox_lo = [
    [sg.Checkbox('Discudemy', default=True)],
    [sg.Checkbox('Udemy Freebies', default=True)],
    [sg.Checkbox('Course Mania', default=True)],
]

c1 = [
    [sg.Frame(
        'Websites',
        checkbox_lo,
        'yellow',
        border_width=4,
    )],
    [
        sg.Button(key='Start',
                  tooltip='Once started will not stop until completed',
                  image_data=start)
Example #24
0
        [
            sg.Text(
                "Both the sqlite3 and DIAMOND databases will take the name"
                " specified here, albeit with their own file type suffixes.",
                size=(TEXT_WIDTH, 2))
        ],
        [TextLabel("Number of CPUs"),
         sg.InputText(key="cpus db")],
        [sg.Text("If no value is supplied all available CPU's will be used.")],
        [TextLabel("Batch size"),
         sg.InputText(key="batch size")],
        [
            sg.Text(
                "Number of genome files to parse before saving them in the local"
                " database. Useful when encountering memory issues with large/many"
                " files. By default, all genome files will be parsed at once.",
                size=(TEXT_WIDTH, 4))
        ],
        [
            TextLabel("Force overwrite files"),
            sg.Checkbox("", default=False, enable_events=True, key="force")
        ],
        [sg.Text("Overwrite pre-existing files, if any are present.")],
    ],
    title_color="blue",
    font="Arial 10 bold",
    relief="flat",
)

layout = [[makedb_frame]]
Example #25
0
def main_screen(attendees=False):
    main_layout = [[
        sg.Text(label[0], size=(label[1], 1))
        for label in (('', 3), ('Name', 10), ('Owner', 10), ('Breed', 10),
                      ('Attended', 10))
    ]]

    print(attendees)

    for dog in dogs.values():
        if attendees:
            attended = dog.id_ in attendees
        else:
            attended = False
        main_layout += [[
            sg.Radio('', 'DOG', key=('dog_id', dog.id_)),
            sg.Text(dog.name, size=(10, 1), key=('name', dog.id_)),
            sg.Text(dog.owner, size=(10, 1), key=('breed', dog.id_)),
            sg.Text(dog.breed, size=(10, 1), key=('owner', dog.id_)),
            sg.Checkbox(default=attended, text='', key=('attendance', dog.id_))
        ]]

    main_layout += [[
        sg.Button('New'),
        sg.Button('Edit'),
        sg.Button('Record Attendance'),
        sg.Exit()
    ]]

    main_window = sg.Window('Top Dog', main_layout)

    while True:
        event, values = main_window.Read()
        print(values)
        if event in (None, 'Exit'):
            break
        elif event == 'New':
            id_ = dog_edit(mode='new')
            print(id_)
            main_window.close()
            attendees = []
            for key, value in values.items():
                if key[0] == 'attendance' and value is True:
                    attendees += [key[1]]
            attendees += [id_]
            print(attendees)
            main_screen(attendees)
        elif event == 'Edit':
            success = False
            for key, value in values.items():
                if key[0] == 'dog_id' and value is True:
                    success = True
                    id_ = key[1]
                    name, breed, owner = dog_edit(mode='edit', id_=id_)
                    main_window[('name', id_)].Update(name)
                    main_window[('breed', id_)].Update(breed)
                    main_window[('owner', id_)].Update(owner)
            if success is False:
                raise ValueError('Couldn\'t find the dog')
        elif event == 'Record Attendance':
            for key, value in values.items():
                attendees = []
                if key[0] == 'attendance' and value is True:
                    attendees.append(key[1])

    main_window.close()
Example #26
0
#PySimple examples (v 3.8)
#Tony Crewe
#Sep 2018

import PySimpleGUI as sg

sg.ChangeLookAndFeel('GreenTan')  #Set colour scheme
sg.SetOptions(font=('Calibri', 12, 'bold'))  #and font

#One checkbox and three radio buttons (grouped as 'Radio1'
layout = [
    [sg.Text('Membership Calculator', font=('Calibri', 16, 'bold'))],
    [
        sg.Checkbox(' Student? 10% off', size=(25, 1)),  #value[0]
        sg.ReadButton('Display Cost', size=(14, 1))
    ],
    [
        sg.Radio('1 month $50', 'Radio1', default=True),  #value[1]
        sg.Radio('3 months $100', 'Radio1'),  #value[2]
        sg.Radio('1 year $300', 'Radio1')
    ],  #value[3]
    [
        sg.Text('',
                size=(30, 1),
                justification='center',
                font=('Calibri', 16, 'bold'),
                key='result')
    ]
]

window = sg.Window('Gym Membership').Layout(layout)
Example #27
0
def main():

    while True:
        #Load data
        fname = r'E:/Project_Code/cdata_20200309.csv'
        with open(fname, 'r') as f:
            reader = csv.reader(f)
            d = []
            for row in reader:
                d.append(row)

        #Create GUI
        window = create_window()
        event, values = window.read()

        if event in [None, 'Cancel']:
            break

        elif event == 'Submit':
            if datetime.today().strftime('%Y-%m-%d') == d[-1][0]:
                sg.popup("You already submitted data for the day!")
                window.close()

            else:

                write_results(values)

                # sg.popup('Title',
                #           'The results of the window.',
                #           'The button clicked was "{}"'.format(event),
                #           'The values are',values)

                window.close()

        elif event == 'Plot':
            window.close()

            scores = [int(x[1]) for x in get_scores(d)]

            #Create new window to get data range form user

            sg.theme('SandyBeach')
            layout = [[sg.Text("Please Choose an Option Below")],
                      [sg.Checkbox("All Data", key='AD')],
                      [sg.Checkbox("Past Year", key='PY')],
                      [sg.Checkbox("Past Tertile", key='PT')],
                      [sg.Button("Plot"), sg.Cancel()]]

            pwindow = sg.Window(title="Plot Function",
                                layout=layout,
                                grab_anywhere=False)
            e2, v2 = pwindow.read()

            if e2 in [None, 'Cancel']:
                pwindow.close()
            else:
                if v2['AD'] == True:
                    y = scores
                    x = [x for x in range(len(y))]
                    t1, t2 = d[0][0], d[-1][0]
                    scatter_plot(x, y, "All Data ({}:{})".format(t1, t2))

                elif v2['PY'] == True:
                    try:
                        y = scores[-365:]
                        x = [x for x in range(len(y))]
                        t1, t2 = d[-365][0], d[-1][0]
                        scatter_plot(x, y, "Pasy Year ({}:{})".format(t1, t2))
                    except IndexError:
                        print("Not Enough Data Yet, Plotting All Data")
                        y = scores
                        x = [x for x in range(len(y))]
                        t1, t2 = d[0][0], d[-1][0]
                        scatter_plot(x, y, "All Data ({}:{})".format(t1, t2))

                elif v2['PT'] == True:
                    try:
                        y = scores[-120:]
                        x = [x for x in range(len(y))]
                        t1, t2 = d[-120][0], d[-1][0]
                        scatter_plot(x, y,
                                     "Past Tertile ({}:{})".format(t1, t2))
                    except IndexError:
                        print("Not Enough Data Yet, Plotting All Data")
                        y = scores
                        x = [x for x in range(len(y))]
                        t1, t2 = d[0][0], d[-1][0]
                        scatter_plot(x, y, "All Data ({}:{}".format(t1, t2))
                else:
                    print("Something went wrong")

                pwindow.close()

        elif event == 'Print Report':

            #Create Window to get Time Range
            window.close()

            rlayout = [[
                sg.Text(text='Number of Months'),
                sg.Spin(values=[x for x in range(7)], initial_value=1)
            ], [sg.Submit(), sg.Cancel()]]

            report_window = sg.Window("Time Range", layout=rlayout)
            r_event, r_value = report_window.read()

            if r_event in [None, 'Cancel']:
                pass
            else:
                tr = int(r_value[0])  #range of time given by user

            report_window.close()

            scores = [int(x[1]) for x in get_scores(d)]
            h = len([x for x in scores if x > 1])
            e = len([x for x in scores if x == 1])
            d = len([x for x in scores if x < 1])
            total = len(scores)

            #Get global percentages
            hp, ep, dp = (h / total) * 100., (e / total) * 100., (d /
                                                                  total) * 100.

            #Get past months scores
            #Going to assume month = 30 days
            nd = 30 * tr
            mh = len([x for x in scores[-nd:] if x > 1])
            me = len([x for x in scores[-nd:] if x == 1])
            md = len([x for x in scores[-nd:] if x < 1])
            total = nd

            mhp, mep, mdp = (mh / total) * 100., (me / total) * 100., (
                md / total) * 100.

            print("Mood Report")
            print("\nGlobal Percentages\n")
            print("Time spent hypo: {}".format(hp))
            print("Time spent euthymic: {}".format(ep))
            print("Time spent depressed: {}".format(dp))
            print("\n\nLast Month\n")
            print("Time spent hypo: {}".format(mhp))
            print("Time spent euthymic: {}".format(mep))
            print("Time spent depressed: {}".format(mdp))

            #Load symptom list
            #Format is date then symptoms in a csv file
            s_fname = r'E:/Project_Code/sdata_20200303.csv'
            with open(s_fname, 'r') as f:
                reader = csv.reader(f)
                sdata = []
                for row in reader:
                    sdata.append(row)

            #Get All Symptoms
            if len(sdata) < tr:
                slist = list(
                    itertools.chain.from_iterable([x[1:] for x in sdata]))
                scounter = collections.Counter(slist)
                mc = scounter.most_common()
                if tr == 1:
                    print("Most Common Symptoms Over the Past Month")
                else:
                    print("Most Common Symptoms Over the Past {} Months\n".
                          format(tr))

                for x in mc:
                    print("{}: {}".format(x[0], x[1]))

            else:
                print("Not Enough Data")

        else:
            sg.popup("Something went very wrong")

    window.close()
AnyPackagesToUpgrade = 0
for i, line in enumerate(fhandle):
    if i not in (0, 1):  # first two lines have no packages
        df1 = df1.append(
            {
                'Package': re.findall('(.+?)\s', line)[0],
                'Version': re.findall('([0-9].+?)\s', line)[0],
                'Latest': re.findall('([0-9].+?)\s', line)[1],
                'Type': re.findall('\s([a-zA-Z]+)', line)[0]
            },
            ignore_index=True)
        AnyPackagesToUpgrade = 1  # if no packages, then don't bring up full UI later on
formlists = []  # This will be the list to be displayed on the UI
i = 0
while i < len(df1):  # this is the checkbox magic that will show up on the UI
    formlists.append([sg.Checkbox(df1.iloc[i, :])])
    formlists.append([sg.Text('-' * 50)])
    i += 1
layout = [[
    sg.Column(layout=[*formlists],
              vertical_scroll_only=True,
              scrollable=True,
              size=(704, 400))
], [sg.Output(size=(100, 10))], [sg.Submit('Upgrade'),
                                 sg.Cancel('Exit')]]
window = sg.Window('Choose Package to Upgrade', layout, size=(800, 650))
if AnyPackagesToUpgrade == 0:
    sg.Popup('No Packages requiring upgrade found')
    fhandle.close()
    os.remove('update.txt')
    quit()
Example #29
0
window.Close()

# Open browser to Github repo if user clicked the "Go to Github" button
if event == github_text:
    webbrowser.open_new_tab(repo)
    raise SystemExit("Cancelling: going to repo")

if event == None:
    #User closed window, leave program
    raise SystemExit("Leaving program")


#Ask for the top folder
layout = [[sg.Text('Select the top folder to generate the MD5 files')],
         [sg.InputText(), sg.FolderBrowse()],
         [sg.Checkbox('Skip folders with md5 files', default = False)],
         [sg.Submit(), sg.Cancel()]]

window = sg.Window('Select folder', layout)
event, values = window.Read()
window.Close()

#User clicked cancel, exit program
if event == 'Cancel':
    raise SystemExit("User pressed Cancel")


folder_to_browse = values[0]
skip_existing_md5 = values[1]

Example #30
0
import PySimpleGUI as sg
import random

import names
import experimental as exp

layout = [[sg.Txt("Random Name Generator")],
          [
              sg.Checkbox("Female", enable_events=True, key="FE"),
              sg.Checkbox("Male", enable_events=True, key="MA")
          ], [sg.Txt("Name:")], [sg.Text(size=(25, 1), key="GEN-NAME")],
          [sg.Button("Generate")], [sg.Txt("Experimental:")],
          [sg.Txt("Name:"),
           sg.Txt(size=(25, 1), key="EXP_NAME")], [sg.Button("Try it")]]
window = sg.Window("Random Name Generator", layout)


def nameExp():
    syllables = random.randint(1, 4)
    name = ""
    vowelStart = random.randint(0, 1)
    if vowelStart == 1:
        name = name + random.choice(exp.vowels)
    for _ in range(0, syllables):
        name = name + random.choice(exp.cons) + random.choice(exp.vowels)
    return name.title()


def main():
    while True:
        event, values = window.read()