コード例 #1
0
    def geolocale_frame():
        """
        This frame helps us group settings related to the geo-location together to present in the GUI for the end-user

        :return:
        """

        import PySimpleGUIQt as qt

        struct = [[
            qt.Text('Street Address:', justification="left"),
            qt.InputText('', key='input_st_address')
        ],
                  [
                      qt.Text('City:', justification='left'),
                      qt.InputText('', key='input_city')
                  ],
                  [
                      qt.Text('State:', justification='left'),
                      qt.InputText('', key='input_state')
                  ],
                  [
                      qt.Text('Lat:', justification='left'),
                      qt.InputText('', key='lat_input'),
                      qt.Text('Lon:', justification='center'),
                      qt.InputText('', key='lon_input'),
                  ]]

        return struct
コード例 #2
0
def generate():
    layout = [
        [
            sg.Text(
                "Betalinger lavet med MobilePay box, bliver ikke vist på stream!",
                font=("def", "def", "bold"),
                text_color="red")
        ], [sg.Text("Det er foreslået at du genererer QR koden,")],
        [sg.Text("ved at bruge dit boxID fra MobilePay appen.\n")],
        [
            sg.Text(
                "Dette gør at dit telefonnummer ikke er bliver vist til alle")
        ],
        [
            sg.Text(
                "og du kan også vælge en standard værdi, som der er på startsiden"
            )
        ], [sg.Text("af MobilePay, når brugeren åbner op for appen.\n")],
        [
            sg.Text("Telefonnummer / BoxID:"),
            sg.InputText(default_text="box10549", key="_NUMBER_")
        ],
        [
            sg.Text("Predefineret værdi:"),
            sg.InputText(default_text="0", key="_AMOUNT_")
        ], [sg.Text("")], [sg.Button("Genererer QR kode")]
    ]

    window = sg.Window("QR code").Layout(layout)

    while True:
        event, values = window.Read()
        if event is None or event == "Exit":
            break

        number = str(values["_NUMBER_"]).lower()
        amount = str(values["_AMOUNT_"]).strip()

        number = number.strip().replace("box", "").replace(" ", "")

        if len(number) > 5 or amount == "0" or amount == "":
            amount = ""
        else:
            amount = f"&amount={amount}"

        url = f"https://mobilepay.dk/box?phone=box{number}{amount}"

        img = qrcode.make(url)
        img = img.resize((320, 320))
        img.save("QR-code.png")

        break

    window.Close()
コード例 #3
0
ファイル: main.py プロジェクト: xj0k/pyroboartim
def test1():
    layout = [[sg.Text(' 输入文字.')],
                     [sg.InputText()],
              [sg.InputText()],
              [sg.Submit(), sg.Cancel()]]

    window = sg.Window('Window 标题', layout)

    event, values = window.Read()
    window.Close()

    text_input = values[0]
    print(text_input)
コード例 #4
0
    def rearrange_layout_of_tab(self) -> None:
        form_rows = [[sg.Text('Enter File Paths:')],
                     [
                         sg.Text('Path to images used as exercises',
                                 size=(15, 1)),
                         sg.InputText(key=self.exercise_dir_key),
                         sg.FolderBrowse(target=self.exercise_dir_key)
                     ],
                     [
                         sg.Text('Path to images used as solutions',
                                 size=(15, 1)),
                         sg.InputText(key=self.solution_dir_key),
                         sg.FolderBrowse(target=self.solution_dir_key)
                     ], [sg.Submit(), sg.Cancel()]]

        self.rows = form_rows
コード例 #5
0
    def restore_from_seed(self):
        logger.debug('In restore_from_seed')
        from mnemonic import Mnemonic
        MNEMONIC = Mnemonic(language="english")

        info1 = (
            "Please enter your BIP39 seed phrase in order to restore your wallet."
        )
        layout = [[sg.Text("Enter Seed")], [sg.Text(info1)],
                  [sg.InputText(key='seed')],
                  [
                      sg.Checkbox('Extends this seed with custom words',
                                  key='use_passphrase')
                  ], [sg.Button('Back'), sg.Button('Next')]]
        window = sg.Window("Satochip-Bridge: Enter seed",
                           layout,
                           icon=self.satochip_icon)
        while True:
            event, values = window.read()
            if event == 'Next':
                if not MNEMONIC.check(
                        values['seed']):  # check that seed is valid
                    self.client.request(
                        'show_error', "Invalid BIP39 seed! Please type again!")
                else:
                    break
            else:  #  event=='Back'
                break
        window.close()
        del window

        # logger.debug("Event:"+str(type(event))+str(event))
        # logger.debug("Values:"+str(type(values))+str(values))
        return (event, values)
コード例 #6
0
    def build_ext_window(self):
        self.layout = self.build_basic_layout()
        for param, param_info in self.effect_params.items():
            if param in ['self', 'area']:
                continue

            if param_info.annotation is Color:
                self.layout.extend([[sg.Text(param)],
                                    [
                                        sg.Input(visible=False,
                                                 enable_events=True,
                                                 key=f'COLOR_{param}'),
                                        sg.ColorChooserButton(
                                            'Pick a color',
                                            key=f'COLOR_{param}_btn',
                                            target=f'COLOR_{param}')
                                    ]])
            elif param_info.annotation is List[Color]:
                self.layout.extend([[sg.Text(param)]])
                for i in range(8):
                    self.layout.extend(
                        [[
                            sg.Input(visible=False,
                                     enable_events=True,
                                     key=f'COLOR_LIST_{i}_{param}')
                        ],
                         [
                             sg.ColorChooserButton(
                                 'Pick a color',
                                 key=f'COLOR_LIST_{i}_{param}_btn',
                                 target=f'COLOR_LIST_{i}_{param}')
                         ]])
            else:
                self.layout.extend([[
                    sg.Text(param)
                ], [sg.InputText(key=param, default_text=param_info.default)]])

        self.layout.extend(
            [[sg.Button('Run', key='RUN')],
             [sg.Button('Stop', key='STOP', visible=False)],
             [sg.Button('Save as default', key='SAVE', visible=True)],
             [
                 sg.Button('Load defaults',
                           key='LOAD',
                           visible=self.has_defaults)
             ],
             [
                 sg.Text('Waiting for the effect thread to stop...',
                         justification='center',
                         key='STOP_TXT',
                         visible=False),
                 sg.Input(visible=False,
                          enable_events=True,
                          key='THREAD_STOPPED')
             ]])

        self.window = sg.Window('Mystic Why', self.layout, finalize=True)
コード例 #7
0
def get_layout(styles: Any, sg: PySimpleGUIQt) -> list:
    """
    Função que retorna o layout utilizado na janela da aplicação.

    Argurments:
        styles (Any): módulo/arquivo com os atributos de estilo
        sg (PySimpleGUIQt): módulo PySimpleGUIQt

    Return:
        list: matriz com o layout do PySimpleGUI
    """
    return [
        [
            sg.Text(' Selecione o arquivo de planilha do Excel para análise',
                    **styles.text_style)
        ],
        [
            sg.InputText('C:\\',
                         enable_events=True,
                         **styles.file_name_input_style),
            sg.FileBrowse(**styles.file_browse_style)
        ], [sg.Text('')],
        [
            sg.Text(' Selecione o lugar onde o novo arquivo será salvo',
                    **styles.text_style)
        ],
        [
            sg.InputText('C:\\planilha-final.xlsx',
                         enable_events=True,
                         **styles.file_name_output_style),
            sg.FileSaveAs(**styles.file_save_style)
        ],
        [
            sg.Text(''),
            sg.Text(''),
            sg.Button('Gerar planilha', **styles.generate_button_style)
        ], [sg.Text('')], [sg.Output()], [sg.Text('')],
        [
            sg.Text(
                'gerador-planilha-desktop © 2021, desenvolvido por João Paulo Carvalho'
            )
        ]
    ]
コード例 #8
0
def login_window():
    submitButton = [[
        sg.Button(button_text="Submit",
                  auto_size_button=True,
                  button_color=('#FFFFFF', '#483D8B'),
                  focus=True)
    ]]
    cancelButton = [[
        sg.Button(button_text="Cancel",
                  auto_size_button=True,
                  button_color=('#FFFFFF', '#483D8B'))
    ]]

    loginLayout = [
        [sg.Text('Tracker Interface - Login')],
        [sg.Text('Username')],
        [sg.InputText()],
        [sg.Text('Password')],
        [sg.InputText(password_char="*")],  # password_char hides text with *
        [sg.Column(submitButton),
         sg.Column(cancelButton)]
    ]

    # Names window as 'Tracker Interface - Login' and assigns its layout to loginLayout.
    window = sg.Window('Tracker Interface - Login',
                       icon="SEAL.jpg").Layout(loginLayout)

    # Reads button events and values entered, stores them in variables.
    event, values = window.Read()

    # If cancel button is pressed, the program is closed.
    if event == "Cancel":
        print("THIS SHOULD CLOSE")
        window.Close()
        driver.close()
        exit()
    elif event == "Submit":
        window.Close()
    # Store username and password variables for later use in login.

    return values
コード例 #9
0
    def create_cred_layout(self):
        """ Layouts in simplepyguy cannot be reused
            need to create new one when (re)-opening windows
            if valid, use configured credentials as default values
        """

        if Config.SERVER and Config.USER and Config.PW:
            self.def_server = Config.SERVER
            self.def_user = Config.USER
            self.def_pw = Config.PW

        layout = [
            [
                sg.Text("Server address: ", size=(30, 1)),
                sg.InputText(default_text=self.def_server, key="server", size=(25, 1)),
            ],
            [
                sg.Text("Disable SSL certificate check: ", size=(30, 1)),
                sg.Checkbox(
                    "(only check if using your own server)",
                    default=not Config.VERIFY_SSL_CERT,
                    key="ignore_cert",
                ),
            ],
            [
                sg.Text("Username: "******"user", size=(25, 1)),
            ],
            [
                sg.Text("Password: "******"pw", size=(25, 1)),
            ],
            [sg.Text("")],
            [
                sg.Button("Login", size=(18, 1)),
                sg.Button("Register", size=(18, 1)),
                sg.Cancel(size=(18, 1)),
            ],
        ]
        return layout
コード例 #10
0
    def get_passphrase(self, msg):
        logger.debug('In get_passphrase')
        layout = [[sg.Text(msg)], [sg.InputText(password_char='*', key='pin')],
                  [sg.Submit(), sg.Cancel()]]
        window = sg.Window('Satochip-Bridge: PIN required',
                           layout,
                           icon=self.satochip_icon)
        event, values = window.read()
        window.close()
        del window

        is_PIN = True if event == 'Submit' else False
        pin = values['pin']
        # logger.debug("Type of pin from getpass:"******"Type of event from getpass:"+str(type(event))+str(event))
        return (is_PIN, pin)
コード例 #11
0
    def __init__(self):
        layout = [[sg.Text('Enter Text')],
                  [sg.Input(size=(17, 1), key='input1', do_not_clear=True)],
                  [
                      sg.InputText(size=(17, 1),
                                   key='input2',
                                   do_not_clear=True)
                  ], [sg.Button('on-screen keyboard', key='keyboard')],
                  [sg.Button('close', key='close')]]

        self.mainWindow = sg.Window(
            'On-screen test',
            grab_anywhere=True,
            no_titlebar=False,
        ).Layout(layout).Finalize()
        self.keyboard = keyboard()
        self.focus = None
コード例 #12
0
def create_conf_window(parser):
    sg.theme(parser.get('gui_settings','theme'))

    def TextLabel(text): return sg.Text(text+':', justification='r', size=(25,1))
    
    layout = [
        [sg.Text('Choose Configuration', font = 'Any 20', justification='c')],
        [sg.Text('')],
        [TextLabel('Output Directory'), sg.Input(key='-OUTDIR-'), sg.FolderBrowse(target='-OUTDIR-')],
        [TextLabel('FASTQ Files Directory'), sg.Input(key='-FASTQ-'), sg.FolderBrowse(target='-FASTQ-')],
        [TextLabel('Spectra Files Directory'), sg.Input(key='-SPECTRA-'), sg.FolderBrowse(target='-SPECTRA-')],
        [sg.Text('')],
        [TextLabel('Trinity'), sg.Input(key='-TRINITY-'), sg.FileBrowse(target='-TRINITY-')],
        [TextLabel('hg19'), sg.Input(key='-HG19-'), sg.FileBrowse(target='-HG19-')],
        [TextLabel('SearchGUI'), sg.Input(key='-SEARCHGUI-'), sg.FileBrowse(target='-SEARCHGUI-')],
        [TextLabel('PeptideShaker'), sg.Input(key='-PEPTIDE-'), sg.FileBrowse(target='-PEPTIDE-')],
        [TextLabel('ACTG'), sg.Input(key='-ACTG-'), sg.FolderBrowse(target='-ACTG-')],
        [sg.Text('')],
        [TextLabel('Transcriptome GTF'), sg.Input(key='-GTF-'), sg.FolderBrowse(target='-GTF-')],
        [TextLabel('Reference genome'), sg.Input(key='-REF-'), sg.FolderBrowse(target='-REF-')],
        [TextLabel('Mapping Method'), sg.Combo(['PV','PS','VO','SO'],key='-MAP-')],
        [TextLabel('Protein Database'), sg.Input(key='-DB-'), sg.FileBrowse(target='-DB-')],
        [TextLabel('Serialization File'), sg.Input(key='-SER-'), sg.FileBrowse(target='-SER-')],
        [sg.Text('')],
        [TextLabel('Bamstats'), sg.Input(key='-BAMSTATS-'), sg.FileBrowse(target='-BAMSTATS-')],
        [TextLabel('BAM Files'), sg.Input(key='-BAM-'), sg.FolderBrowse(target='-BAM-')],
        [TextLabel('BED File'), sg.Input(key='-BED-'), sg.FileBrowse(target='-BED-')],
        [sg.Text('')],
        [TextLabel('DeNoPro Location'), sg.Input(key='-DENOPRO-'), sg.FolderBrowse(target='-DENOPRO-')],
        [sg.Text('')],
        [TextLabel('Theme'), sg.Combo(sg.theme_list(), size=(17, 0.8), key='-THEME-')],
        [sg.Text('')],
        [sg.Text('')],
        [sg.Button('Save'), 
            sg.InputText('', do_not_clear=False, visible=False, key='-filename-',enable_events=True),
            sg.FileSaveAs('Save As'),sg.Button('Exit')]
    ]

    window = sg.Window("Config", keep_on_top=True).Layout([[sg.Column(layout,size = (680,720),scrollable=True)]]).Finalize()

    for k,v in conf_keys.items():
        try:
            window[conf_keys[k][2]].update(value=parser.get(v[0],k))
        except Exception as e:
            print(f'Problem updating GUI window from config. Key = {k}')
    return window
コード例 #13
0
    def reset_seed_dialog(self, msg):
        logger.debug('In reset_seed_dialog')
        layout = [[sg.Text(msg)], [sg.InputText(password_char='*', key='pin')],
                  [sg.Checkbox('Also reset 2FA', key='reset_2FA')],
                  [sg.Button('Ok'), sg.Button('Cancel')]]
        window = sg.Window("Satochip-Bridge: Reset seed",
                           layout,
                           icon=self.satochip_icon)
        event, values = window.read()
        window.close()
        del window

        # logger.debug("Event:"+str(type(event))+str(event))
        # logger.debug("Values:"+str(type(values))+str(values))
        #Event:<class 'str'>Ok
        #Values:<class 'dict'>{'passphrase': 'toto', 'reset_2FA': False}
        return (event, values)
コード例 #14
0
    def confirm_passphrase(self):
        logger.debug('In confirm_passphrase')
        info1 = (
            "Your seed extension must be saved together with your seed.\nPlease type it here."
        )
        layout = [[sg.Text("Confirm seed extension")], [sg.Text(info1)],
                  [sg.InputText(key='passphrase_confirm')],
                  [sg.Button('Back'), sg.Button('Next')]]
        window = sg.Window("Satochip-Bridge: Confirm seed extension",
                           layout,
                           icon=self.satochip_icon)
        event, values = window.read()
        window.close()
        del window

        logger.debug("Event:" + str(type(event)) + str(event))
        logger.debug("Values:" + str(type(values)) + str(values))
        #Event:<class 'str'>Next
        #Values:<class 'dict'>{'seed_confirm': 'AA ZZ'}
        return (event, values)
コード例 #15
0
    def confirm_seed(self):
        logger.debug('In confirm_seed')
        pyperclip.copy('')  #purge clipboard to ensure that seed is backuped
        info1 = (
            "Your seed is important! If you lose your seed, your money will be \npermanently lost. To make sure that you have properly saved your \nseed, please retype it here:"
        )
        layout = [[sg.Text("Confirm seed")], [sg.Text(info1)],
                  [sg.InputText(key='seed_confirm')],
                  [sg.Button('Back'), sg.Button('Next')]]
        window = sg.Window("Satochip-Bridge: Confirm seed",
                           layout,
                           icon=self.satochip_icon)
        event, values = window.read()
        window.close()
        del window

        logger.debug("Event:" + str(type(event)) + str(event))
        logger.debug("Values:" + str(type(values)) + str(values))
        #Event:<class 'str'>Next
        #Values:<class 'dict'>{'seed_confirm': 'AA ZZ'}
        return (event, values)
コード例 #16
0
    def geolocale_frame(self, opt_name=None):
        """
        This frame helps us group settings related to the geo-location together to present in the GUI for the end-user

        :return:
        """
        qt = self.qt

        struct = []

        for option in self.config.options(section='location'):
            opt_name = str(option).replace('_', ' ')
            opt_name = opt_name.capitalize()
            new_line = [
                qt.Text(opt_name, justification='left'),
                qt.InputText(f'{self.config.get("location", option)}')
            ]

            struct.append(new_line)

        return struct
コード例 #17
0
    def _weather_api_frame_(self):
        """
        This frame helps us group settings related to the weather API together to present in the GUI for the end-user


        :return:
        """
        import PySimpleGUIQt as qt

        struct = [[
            qt.Text('DarkSky API Key:', justification='left'),
            qt.InputText(self.config.get("weather_api_settings", "key"),
                         key='darksky_api_key_input',
                         justification='right')
        ],
                  [
                      qt.Button('Reset', key='reset_fields'),
                      qt.Button('Check Key', key='check_api_key')
                  ]]

        return struct
コード例 #18
0
ファイル: gui.py プロジェクト: Azzzrail/ZMQ_read
def ask_port():
    global input_field_1
    sgQT.theme('DarkAmber')  # Add a touch of color
    # All the stuff inside your window.
    layout = [
        [sgQT.Text('TEST_TEST_TEST')],
        # кнопка для выбора папки с файлами
        # [sg.T('Source Folder')], [sg.In(key='input')], [sg.FolderBrowse(target='input')],
        # Поле для ввода номера канала
        [sgQT.Text('Enter port number'),
         sgQT.InputText()],

        # [sg.Text('Plot tools enable/disable')],
        # чербоксы для работы с нарисованной гистограммой
        # [sg.Checkbox('pan', default=True), sg.Checkbox('wheel_zoom', default=True),
        # sg.Checkbox('box_zoom', default=True), sg.Checkbox('reset', default=True),
        # sg.Checkbox('save', default=True), sg.Checkbox('box_select', default=True)],
        # [sg.Checkbox('lasso_select', default=True),
        # sg.Checkbox('crosshair', default=True), sg.Checkbox('hover', default=True)],
        # Конец чекбоксов
        [sgQT.Button('Ok'), sgQT.Button('Cancel')]
    ]
    # TODO: Добавить вычитку состояний чекбоксов
    # Create the Window
    window = sgQT.Window('Window Title', layout)
    # Event Loop to process "events" and get the "values" of the inputs
    while True:
        event, values = window.read()
        if event in (None, 'Cancel'):  # if user closes window or clicks cancel
            break
        elif event in 'Ok':
            input_field_1 = int(values[0])
            break

    window.close()

    try:
        return input_field_1
    except NameError:
        return None
コード例 #19
0
    def request_passphrase(self):
        logger.debug('In request_passphrase')
        info1 = (
            "You may extend your seed with custom words.\nYour seed extension must be saved together with your seed."
        )
        info2 = (
            "Note that this is NOT your encryption password.\nIf you do not know what this is, leave this field empty."
        )
        layout = [[sg.Text("Seed extension")], [sg.Text(info1)],
                  [sg.InputText(key='passphrase')], [sg.Text(info2)],
                  [sg.Button('Back'), sg.Button('Next')]]
        window = sg.Window("Satochip-Bridge: Seed extension",
                           layout,
                           icon=self.satochip_icon)
        event, values = window.read()
        window.close()
        del window

        logger.debug("Event:" + str(type(event)) + str(event))
        logger.debug("Values:" + str(type(values)) + str(values))
        #Event:<class 'str'>Next
        #Values:<class 'dict'>{'passphrase': 'toto'}
        return (event, values)
コード例 #20
0
def main():
    sg.theme('Reddit')

    layout = [[sg.Text('', font=('Times', 12), key='timer')],
              [
                  sg.Text('Input Audio', size=(10, 1), font='Times 14'),
                  sg.InputText(key="audioIN", size=(50, 1)),
                  sg.FileBrowse(initial_folder="/home", target="audioIN")
              ],
              [
                  sg.Text('Input Data', size=(10, 1), font='Times 14'),
                  sg.InputText(key="dataIN", size=(50, 1)),
                  sg.FileBrowse(initial_folder="/home", target="dataIN")
              ],
              [
                  sg.Text('Encode To', size=(10, 1), font='Times 14'),
                  sg.InputText(key="audioOUT", size=(50, 1)),
                  sg.FolderBrowse(initial_folder="/home", target="audioOUT")
              ],
              [
                  sg.Submit('Encode', size=(10, 1)),
                  sg.Submit('Datafy', size=(10, 1)),
                  sg.Cancel('Quit', size=(10, 1))
              ]]

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

    ####### Main Event Loop ########
    while True:
        event, values = window.read()
        if event == sg.WIN_CLOSED or event == "Quit":
            break

        ######### When User hits "Encode" button #########
        if event == "Encode":
            ## Get time for timing encoding
            start_time = int(round(time.time() * 100))

            ## Get variables for encodeMP3 call
            input_audio = values["audioIN"]
            input_data = values["dataIN"]
            output_audio = values["audioOUT"]
            output_data = get_file(input_data)

            ## Update window to prepare for processing
            window['timer'].Update('Processing...')
            window.Refresh()

            ## Call ffmpeg to encode to mp3
            emp3.encodeMP3(input_audio, output_data, output_audio)

            ## Calculate and report encoding completion time
            final_time = int(round(time.time() * 100)) - start_time
            format_time = '{:02d}:{:02d}.{:02d}'.format(
                (final_time // 100) // 60, (final_time // 100) % 60,
                final_time % 100)

            window['timer'].update(f"Encoded in {format_time}.")

        ######### When User hits "Datafy" button #########
        if event == "Datafy":
            ## Get time for timing encoding
            start_time = int(round(time.time() * 100))

            ## Get variables for dataMP3 call
            input_audio = values["audioIN"]
            input_data = values["dataIN"]
            output_audio = values["audioOUT"]

            ## Update window to prepare for processing
            window['timer'].Update('Processing...')
            window.Refresh()

            if values["audioIN"] == values["audioOUT"]:
                window['timer'].update(
                    "WARNING: Output file cannot be same as input.")
                window.Refresh()

            else:
                ## Make ffmpeg-readable data file
                output_data = get_file(input_data)

                ## Call ffmpeg to add data to mp3
                emp3.dataMP3(input_audio, output_data, output_audio)

                ## Calculate and report encoding completion time
                final_time = int(round(time.time() * 100)) - start_time
                format_time = '{:02d}:{:02d}.{:02d}'.format(
                    (final_time // 100) // 60, (final_time // 100) % 60,
                    final_time % 100)

                window['timer'].update(f"Data added in {format_time}.")

    window.close()
コード例 #21
0
ファイル: gui-lotto-func.py プロジェクト: xj0k/pyroboartim
import sys,os
import PySimpleGUIQt as sg
import time
import random

buttonSize = (8, 2)
buttonColor = ('white', 'grey')
buttonColorHit = ('white', 'red')
buttonFont = (1, 24)

layout = [
    [sg.InputText(size=(24,2),key='display',font=buttonFont,disabled=True,default_text='请抽奖',justification='center')],
    [
        sg.Button("电脑", key='1',size=buttonSize,font=buttonFont, button_color=buttonColor),
        sg.Button("游戏机", key='2', size=buttonSize,font=buttonFont, button_color=buttonColor),
        sg.Button("假期", key='3',size=buttonSize,font=buttonFont, button_color=buttonColor)
    ],
    [
        sg.Button("手机", key='8', size=buttonSize,font=buttonFont, button_color=buttonColor),
        sg.Button("start",key='start', size=buttonSize,font=buttonFont, button_color=('red','white')),
        sg.Button("电视", key='4', size=buttonSize,font=buttonFont, button_color=buttonColor)
    ],
    [
        sg.Button("冰箱", key='7', size=buttonSize,font=buttonFont, button_color=buttonColor),
        sg.Button("洗衣机", key='6', size=buttonSize,font=buttonFont, button_color=buttonColor),
        sg.Button("汽车", key='5', size=buttonSize,font=buttonFont, button_color=buttonColor)
    ]
]

window = sg.Window('幸运大抽奖', layout)
コード例 #22
0
ファイル: GUI.py プロジェクト: jamesonion/SpotifyP3
     sg.Text(
         "Add Songs you Enjoy One by One to Receive a Personalized Playlist",
         key='-SUBTITLE-',
         justification='center',
         background_color='NONE',
         auto_size_text=True)
 ],
 [
     sg.Button('Like', visible=False),
     sg.Button('Play', visible=False),
     sg.Button('Next', visible=False)
 ],
 [
     sg.InputText(default_text="Enter your song here",
                  enable_events=True,
                  do_not_clear=True,
                  justification='center',
                  size=(50, 1),
                  key='-SONG-'),
     sg.InputText(default_text="Enter artist name",
                  enable_events=True,
                  do_not_clear=True,
                  justification='center',
                  size=(50, 1),
                  key='-ARTIST-',
                  visible=False)
 ], [sg.Text(key='-OUTPUT-', background_color='NONE')],
 [
     sg.Button('Add Song', size=(25, 1)),
     sg.Button('Add Artist', size=(25, 1), visible=False),
     sg.Button('Submit', size=(25, 1))
 ],
コード例 #23
0
ファイル: gui-calc-func.py プロジェクト: xj0k/pyroboartim
import sys
import PySimpleGUIQt as sg

buttonSize = (4, 1)
buttonColor = ('white', 'grey')

layout = [[
    sg.InputText(size=(21.5, 1),
                 background_color='white',
                 text_color='black',
                 key='display',
                 disabled=True)
],
          [
              sg.Button("1", size=buttonSize, button_color=buttonColor),
              sg.Button("2", size=buttonSize, button_color=buttonColor),
              sg.Button("3", size=buttonSize, button_color=buttonColor),
              sg.Button("+", size=buttonSize, button_color=buttonColor),
              sg.Button("-", size=buttonSize, button_color=buttonColor)
          ],
          [
              sg.Button("4", size=buttonSize, button_color=buttonColor),
              sg.Button("5", size=buttonSize, button_color=buttonColor),
              sg.Button("6", size=buttonSize, button_color=buttonColor),
              sg.Button("*", size=buttonSize, button_color=buttonColor),
              sg.Button("/", size=buttonSize, button_color=buttonColor)
          ],
          [
              sg.Button("7", size=buttonSize, button_color=buttonColor),
              sg.Button("8", size=buttonSize, button_color=buttonColor),
              sg.Button("9", size=buttonSize, button_color=buttonColor),
コード例 #24
0
# -*- coding:utf-8 -*-
'''
安装PysimpleGUI:
$python -m pip install PySimpleGUIQt
'''
import PySimpleGUIQt as sg

#查看所有的主题
#    sg.preview_all_look_and_feel_themes()
#切换主题
sg.change_look_and_feel("GreenMono")

#首先创建一个小部件(widget)
text = sg.Text("This is a test")  #建立一个文本部件
textinput = sg.InputText()  #建立一个文本输入部件
bt = sg.Button('OK')  #建立一个按钮部件
cbt = sg.Button('Cancel')  #建立按钮部件
layout = [[text, textinput], [bt, cbt]]  #建立布局
'''
这里要注意,按行布局要把同一行中的所有部件放入同一个列表,如上面的布局我们就会得到
text, textinput在同一行
bt,与cbt在同一行
最后会形成一个嵌套的列表
'''
#3. 建立窗体,窗体包含名字与我们希望设定的部件
window = sg.Window('Welcome', layout)  #输入窗体的名字与我们之前设定好的layout

#4. 创建一个循环让GUI界面运行同时读取与获取输入输出值;一个图形用户交互页面需要一个循环来运行同时等待使用者去做事件
# 一般用一个while循环包含逻辑,break结束
while True:
    event, values = window.read()
コード例 #25
0
ファイル: client.py プロジェクト: jahosp/rsteg-tcp
                        filemode='w',
                        format='%(asctime)s - %(levelname)s - %(message)s',
                        datefmt='%m/%d/%Y %I:%M:%S %p',
                        level=logging.DEBUG)
    logger.setLevel(logging.DEBUG)

    # Application Layout
    sg.theme('Default')

    # HTTP Frame Layout
    http_frame = [
        sg.Frame(
            'HTTP Parameters',
            layout=[[
                sg.Text('URL :', size=(15, 1)),
                sg.InputText(enable_events=True, key='url')
            ],
                    [
                        sg.Text('Request type: ', size=(15, 1)),
                        sg.Combo(values=['GET', 'POST'],
                                 default_value='GET',
                                 readonly=True,
                                 auto_size_text=True,
                                 enable_events=True,
                                 key='http_request')
                    ],
                    [
                        sg.Frame(
                            'Data',
                            layout=[[
                                sg.Text('Cover data', size=(8, 1)),
コード例 #26
0
ファイル: main.py プロジェクト: katustrica/zenit
settings = [
    ['Выдано БГ', '91315', 'oitgp'],
    ['Погашено БГ', '91315', 'oitga'],
    ['Портфель БГ', '91315', 'iitg'],
    ['Комиссия БГ', '47502', 'oitga'],
    ['Выдачи в рамках лимита', '91319', 'oitga'],
    ['Неис лимиты БГ на дату', '91319', 'iitg'],
    ['Выплачено по требованию БГ', '60315', 'oitga'],
    ['Дефолтность портфеля', '60315', 'oitga', '91315', 'iitg'],
    ['Доходность выдач', '47502', 'oitga', '91315', 'oitgp']
]

layout1 = [
    [
        sg.Frame('Номера банков', [[
            sg.Text('№, №'), sg.InputText('1481', key='-REGNUMS-'),
            ]]
        )

    ],
    [sg.Button('Настройки парсинга')],
    [
        sg.Frame('Список банков', [[
            sg.Listbox(values=[], select_mode=sg.LISTBOX_SELECT_MODE_MULTIPLE, key='-LISTBOX-')
            ]]
        )
    ],
    [sg.Button('Взять данные'), sg.Text(' ' * 79), sg.Button('Удалить')],
    [
        sg.Frame('Cохранение', [[
                sg.FolderBrowse('Выберете папку', target='-PATH-'),
コード例 #27
0
ファイル: wt-metrics.py プロジェクト: erentar/wt-metrics.py
                for frame in dataLog:
                    data[0].append(frame[data[1]])

            #plot the data
            plt.plot(xdata, ydata)
            plt.xlabel(xmetric)
            plt.ylabel(ymetric)
            plt.show()
    if event == pygui.WIN_CLOSED:
        plotWindow.close()

guiWindow = \
pygui.Window(
    "War Thunder Data Recorder and Grapher",
    [
        [pygui.Text("Source:"),pygui.InputText(default_text="localhost:8111",key="url"),pygui.Button("Select metrics")],
        [pygui.Text("Output file (csv):"),pygui.InputText(default_text="out.csv",key="outfile"),pygui.Text("Logging interval (ms):"),pygui.InputText(default_text="200",key="interval",size=(4,1))],
        [(startButton := pygui.Button("Start")),(saveButton := pygui.Button("Save",disabled=True)),(resetButton := pygui.Button("Reset",disabled=True)),(plotButton := pygui.Button("Graph",disabled=True))]
    ]
)


def keylistInDatalog(dataLog):
    keyList = []
    for frame in dataLog:
        for key in list(frame.keys()):
            if key not in keyList:
                keyList.append(key)
    return keyList

コード例 #28
0
                justification='center',
                size=(100, 22))
    ],
    [sg.Spin((1, 10), size=(100, 22))],
    [sg.Spin((1, 10), size=(100, 22))],
    [sg.Spin((1, 10), size=(100, 22))],
]

layout = [
    [
        sg.Text('(Almost) All widgets in one Window!',
                justification='c',
                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', size=(400, 22))],
    [
        sg.Frame(
            layout=[[
                sg.Checkbox('Checkbox', size=(185, 22)),
                sg.Checkbox('My second checkbox!', default=True)
            ],
                    [
                        sg.Radio(
                            'My first Radio!',
                            "RADIO1",
                            default=True,
                            size=(180, 22),
                        ),
                        sg.Radio('My second Radio!', "RADIO1")
                    ],
コード例 #29
0
def im_login():
    gClient.add_event_handler("session_start", tstart)
    gClient.add_event_handler("message", tmessage)

    if gClient.connect(server):
        print("Connected, start processing messages.")
        gClient.process(block=False)
        print("Done.")
    else:
        print("Unable to connect.")


layout = [[sg.Text("Will start chat.")],
          [
              sg.InputText(key='message',
                           default_text='please input message here')
          ], [sg.InputText(key='recv')],
          [sg.Button("start chat", key='start')],
          [sg.Button('send', key='send'),
           sg.Button('exit', key='exit')]]
window = sg.Window("chatting", layout)
while True:
    event, values = window.read()
    print(event, values)
    if event == 'exit' or event is None:
        im_logout()
        window.close()
        sys.exit(0)

    if event == 'start':
        print("will start chat process.")
コード例 #30
0
ファイル: aud-gui.py プロジェクト: zdhoward/aud
import PySimpleGUIQt as sg
from aud import Dir

sg.change_look_and_feel("DarkAmber")  # Add a little color

frm_dir = sg.Frame(
    title="Working Directory:",
    layout=[
        [
            sg.InputText(key="_selected_dir_", size=(44, 1), disabled=True),
            sg.Button("Browse", size=(5, 1)),
        ]
    ],
)

frm_output_dir = sg.Frame(
    title="Output Directory:",
    layout=[
        [
            sg.InputText(key="_output_dir_", size=(44, 1), disabled=True),
            sg.Button("Browse", size=(5, 1)),
        ]
    ],
)

frm_config = sg.Frame(
    title="Config:",
    layout=[
        [sg.Text("Directory:", size=(15, 1)), sg.InputText(key="_dir_", size=(37, 1))],
        [sg.Text("Extensions:", size=(15, 1)), sg.InputText(key="_ext_", size=(37, 1))],
        [sg.Text("Blacklist:", size=(15, 1)), sg.InputText(key="_bl_", size=(37, 1))],