示例#1
0
def tela_excluir():
    """
    Tela para confirmação da exclusão de um emprestimo.
    :return: um valor booleano, para confirmação ou negação da ação.
    """
    layout = [[Text('Tem certeza que deseja excluir?')],
              [
                  Button("Sim",
                         size=(8, 1),
                         button_color=('white', 'springgreen4'),
                         pad=(20, 1)),
                  Button("Não",
                         size=(8, 1),
                         button_color=('white', 'firebrick3'))
              ]]
    janela = Window(
        'Excluir',
        icon=('C:\\Loans-management\\Icon\\icon-logo.ico')).Layout(layout)
    botao, evento = janela.Read()
    if botao == 'Sim':
        janela.Close()
        return True
    else:
        janela.Close()
        return False
示例#2
0
 def __init__(self, user):
     self.window = Window('Alterar senha').layout(
         [[Text(f'Senha atual: '),
           Input(key='old_password')],
          [Text('Nova senha: '),
           Input(key='password')], [Button('Voltar'),
                                    Button('Confirmar')]])
示例#3
0
 def _prepare_button_rows(self):
     bkw = {'size': (18, 1)}
     view_button_rows = [
         [
             Button('Clean & Add BPM', key='clean', **bkw),
             Button('View All Tags', key='all_tags', **bkw),
             Button('Edit', key='edit', **bkw),
             Button('Wiki Update', key='wiki_update', **bkw),
         ],
         [
             Button('Sync Ratings From...', key='sync_ratings::dst_album', **bkw),
             Button('Sync Ratings To...', key='sync_ratings::src_album', **bkw),
             Button('Copy Tags From...', key='copy_data', **bkw),
         ],
     ]
     edit_buttons = [Button('Review & Save Changes', key='save', **bkw), Button('Cancel', key='cancel', **bkw)]
     album_buttons = [
         Column(view_button_rows, key='col::view_buttons', visible=not self.editing, element_justification='center'),
         Column([edit_buttons], key='col::edit_buttons', visible=self.editing),
     ]
     open_button = Button(
         '\U0001f5c1',
         key='select_album',
         font=('Helvetica', 20),
         size=(10, 1),
         tooltip='Open',
         visible=not self.editing,
     )
     return [album_buttons, [open_button]]
示例#4
0
 def __init__(self, img_size: tuple[int, int] = None):
     self.img_size = img_size or (40, 40)
     self._num = next(self.__counter)
     kp = f'result:{self._num}'
     self.image = ExtendedImage(size=self.img_size,
                                key=f'{kp}:cover',
                                pad=((20, 5), 3))
     if self._play_icon is None:
         ResultRow._play_icon = img_to_b64(PLAY_ICON)
     self.play_button = Button(image_data=self._play_icon, key=f'{kp}:play')
     self.result_type = None
     self.fields: dict[str, ExtText] = {
         field:
         ExtText(size=size,
                 key=f'{kp}:{field}',
                 justification='right' if field in ('duration',
                                                    'plays') else None)
         for field, size in FIELD_SIZES.items() if field != 'play'
     }
     self.rating = Rating(key=f'{kp}:rating', change_cb=self.rating_changed)
     self.visible = True
     self.row = [
         self.image, *(cell.pin for cell in self.fields.values()),
         self.rating, self.play_button
     ]
     self.result: Optional[Result] = None
示例#5
0
def tela_escolha_busca():
    """
    Tela na qual o usuário escolhera qual o método de busca.
    :return: retorna uma string, sendo a escolha do usuário.
    """
    layout_busca = [[T("Deseja buscar por:", size=(30, 1))],
                    [
                        Button("Nome",
                               button_color=('white', 'springgreen4'),
                               size=(8, 1)),
                        Button("Item",
                               button_color=('white', 'springgreen4'),
                               size=(8, 1)),
                        Button("Ano",
                               button_color=('white', 'springgreen4'),
                               size=(8, 1)),
                        Button("Mes + Ano",
                               button_color=('white', 'springgreen4'),
                               size=(10, 1))
                    ],
                    [
                        Button("Cancelar",
                               button_color=('white', 'firebrick3'),
                               size=(8, 1),
                               pad=(150, 0))
                    ]]
    janela_busca = Window(
        "Buscas",
        size=(400, 100),
        text_justification=('center'),
        icon=(
            'C:\\Loans-management\\Icon\\icon-logo.ico')).Layout(layout_busca)
    botao_busca, valores_busca = janela_busca.Read()
    janela_busca.Close()
    return botao_busca
示例#6
0
 def __init__(self, user):
     self.window = Window('Minha conta').layout(
         [[Text(f'Usuário: {user.username}')],
          [Text(f'Senha: {user.password}')],
          [Text(f'Data inserção: {user.date}')], [Button('Alterar senha')],
          [Button('Voltar'),
           Button('Trocar Conta'),
           Button('Excluir')]])
示例#7
0
 def __init__(self, field, value):
     self.__validator = validator
     self.window = Window('Atualiza funcionário')
     layout = [[
         Text(f'Informe o/a {field} do funcionário:'),
         Input(key=field, default_text=value)
     ], [Button('Ok!'), Button('Manter')]]
     self.window.layout(layout)
示例#8
0
 def __init__(self, _list):
     layout = []
     for item in _list.items.values():
         layout += [
             [Button(f'{item.title}')],
         ]
     self.window = Window('Selecione um item').layout(layout +
                                                      [[Button('Voltar')]])
示例#9
0
 def __init__(self):
     layout = [
         [Text('O que você quer fazer?')],
         [Text('Gerenciar funcionários'), Button('0')],
         [Text('Gerenciar veículos'), Button('1')],
         [Text('Gerenciar movimentações'), Button('2')],
         [Button('Sair')]
     ]
     self.window = Window('Claviculário Eletrônico').Layout(layout)
示例#10
0
文件: screens.py 项目: cavrau/aps
 def __init__(self, genres):
     self.window = Window('Criar meta').layout(
         [[Text('Prazo: '),
           Input(key='prazo'),
           Text(' dias')],
          [Text('Objetivo: '),
           Input(key='objetivo'),
           Text(' obras')], [Text('Genero: '),
                             Combo(genres, key='genre')],
          [Button('Voltar'), Button('Criar meta')]])
示例#11
0
 def __init__(self):
     self.window = Window('Menu movimentações').layout(
         [
             [Text('O que você deseja fazer?')],
             [Text('Filtrar movimentação'), Button('0')],
             [Text('Obter relatório por tipo'), Button('1')],
             [Text('Retirar veículo'), Button('2')],
             [Text('Devolver veículo'), Button('3')],
             [Button('Voltar')]
         ]
     )
示例#12
0
    def as_workflow(self,
                    content: Layout,
                    back_key: str = 'btn::back',
                    next_key: str = 'btn::next',
                    scrollable: bool = False,
                    **kwargs) -> list[Element]:
        self._back_key = back_key
        self._next_key = next_key
        section_args = {'back': {}, 'next': {}}
        for key, val in tuple(kwargs.items()):
            if key.startswith(('back_', 'next_')):
                kwargs.pop(key)
                section, arg = key.split('_', 1)
                section_args[section][arg] = val

        if self.last_view:
            section_args['back'].setdefault('tooltip',
                                            self.last_view.back_tooltip)

        kwargs.update(size=(1, 2), pad=(0, 0), font=('Helvetica', 60))
        back_col = Column([[
            Button('\u2770', key=back_key, **section_args['back'], **kwargs)
        ]],
                          key='col::back')
        next_col = Column([[
            Button('\u2771', key=next_key, **section_args['next'], **kwargs)
        ]],
                          key='col::next')

        content_args = dict(justification='center',
                            vertical_alignment='center',
                            expand_y=True,
                            expand_x=True)
        if scrollable:
            content_args.update(scrollable=True, vertical_scroll_only=True)
            # The below Image is a workaround to make it possible to center scrollable columns.
            win_w, win_h = self._window_size
            # back/next button column widths: 55px each => 110 + outer padding (10px each) => 130
            # + inner padding (left, 10px) => 140
            # + scrollbar (17px) => 157 + ??? (2px) => 159
            content.append([
                Image(size=(win_w - 159, 1),
                      pad=(0, 0),
                      key='img::workflow::spacer')
            ])

        content_column = Column(content,
                                key='col::__inner_content__',
                                pad=(0, 0),
                                **content_args)

        return [back_col, content_column, next_col]
示例#13
0
def tela_atualizacao(informacao_antiga):
    """
    Tela para atualizar informações de um emprestimo já cadastrado.
    :param informacao_antiga: um dicionário contento todas as antigas informações do emprestimo.
    :return: uma lista de valores, contento o conteúdo dos InputText.
    """
    layout = [
        [Text("Atualizar emprestimo")],
        [
            Text("Nome", size=(15, 1)),
            InputText(default_text=informacao_antiga['nome'],
                      do_not_clear=True)
        ],
        [
            Text("Telefone Fixo", size=(15, 1)),
            InputText(default_text=informacao_antiga['telefone'],
                      do_not_clear=True)
        ],
        [
            Text("Celular", size=(15, 1)),
            InputText(default_text=informacao_antiga['celular'],
                      do_not_clear=True)
        ],
        [
            Text("E-mail", size=(15, 1)),
            InputText(default_text=informacao_antiga['email'],
                      do_not_clear=True)
        ],
        [
            Text("De onde conhece", size=(15, 1)),
            InputText(default_text=informacao_antiga['vivencia'],
                      do_not_clear=True)
        ],
        [
            Text("Data", size=(15, 1)),
            InputText(
                default_text=informacao_antiga['data'].strftime("%d/%m/%Y"),
                do_not_clear=True)
        ],
        [
            Text("Item", size=(15, 1)),
            InputText(default_text=informacao_antiga['item'],
                      do_not_clear=True)
        ],
        [
            Button("Atualizar", button_color=('white', 'springgreen4')),
            Cancel(button_text="Cancelar",
                   button_color=('white', 'firebrick3'))
        ]
    ]
    janela = Window(
        "Cadastro",
        icon=('C:\\Loans-management\\Icon\\icon-logo.ico')).Layout(layout)
    botao, valores = janela.Read()
    print(valores)
    if botao == "Atualizar":
        janela.Close()
        return valores
    elif botao == 'Cancelar':
        janela.Close()
示例#14
0
    def get_render_args(self) -> RenderArgs:
        try:
            layout = [[Menu(self.menu)]]
        except AttributeError:
            layout = []

        if self.__class__ is PlexView and not self._init_event:
            image = image_to_bytes(ICONS_DIR.joinpath('search.png'),
                                   size=(200, 200))
            button = Button('Search',
                            image_data=image,
                            image_size=(210, 210),
                            font=('Helvetica', 18),
                            bind_return_key=True)
            inner_layout = [[Image(key='spacer::2', pad=(0, 0))], [button],
                            [Image(key='spacer::1', pad=(0, 0))]]
            content = Column(
                inner_layout,
                vertical_alignment='center',
                justification='center',
                element_justification='center',
                expand_y=True,
                expand_x=True,
            )
            layout.append([content])

        kwargs = {'title': f'Plex Manager - {self.display_name}'}
        return layout, kwargs
示例#15
0
def tela_cadastro():
    """
    Tela para cadastro de novo emprestimo.
    :return: uma lista contento as informações inputadas.
    """
    layout = [[Text("Cadastrar emprestimo")],
              [Text("Nome", size=(15, 1)),
               InputText()],
              [Text("Telefone Fixo", size=(15, 1)),
               InputText()], [Text("Celular", size=(15, 1)),
                              InputText()],
              [Text("E-mail", size=(15, 1)),
               InputText()],
              [Text("De onde conhece", size=(15, 1)),
               InputText()],
              [
                  Text("Data", size=(15, 1)),
                  InputText("ex: dia/mês/ano", do_not_clear=False)
              ], [Text("Item", size=(15, 1)),
                  InputText()],
              [
                  Button("Cadastrar", button_color=('white', 'springgreen4')),
                  Cancel(button_text="Cancelar",
                         button_color=('white', 'firebrick3'))
              ]]
    janela = Window(
        "Cadastro",
        disable_close=True,
        icon=('C:\\Loans-management\\Icon\\icon-logo.ico')).Layout(layout)
    botao, valores = janela.Read()
    if botao == "Cadastrar":
        janela.Close()
        return valores
    elif botao == 'Cancelar' or botao is None:
        janela.Close()
示例#16
0
文件: screens.py 项目: cavrau/aps
 def __init__(self, movie):
     image = Image.open(movie.poster)
     image.thumbnail((400, 400))
     bio = io.BytesIO()
     image.save(bio, format="GIF")
     if isinstance(movie, Movie):
         self.window = Window(f'Filme : {movie.title}').layout(
             [[ImageField(data=bio.getvalue())],
              [Text(movie.title), Text(movie.year)], [Text('Genres:')],
              [Text(', '.join(movie.genre))], [Text('Actors:')],
              [Text(', '.join(movie.actors))],
              [Text('Plot:  ' + movie.plot)],
              [Text('Awards:  ' + movie.awards)],
              [Text('Director: '), Text(movie.director)],
              [Text('Writer: '), Text(movie.writer)],
              [Button('Voltar'),
               Button('Adicionar a Lista')]])
示例#17
0
 def __init__(self, field):
     self.__validator = validator
     self.window = Window('Adiciona funcionário')
     layout = [[
         Text(f'Informe o/a {field} do funcionário:'),
         Input(key=field)
     ], [Button('Ok!')]]
     self.window.layout(layout)
示例#18
0
def showLongInfo(prompt: str, text: str) -> None:
    win: Window = Window(alpha_channel=0.8, finalize=True, debugger_enabled=False, resizable=True,
                         text_justification="center", title=prompt.strip(), no_titlebar=True, keep_on_top=True,
                         disable_close=True, disable_minimize=True, grab_anywhere=True, auto_size_text=True, layout=[
            [Text(text=prompt.strip(), expand_x=True, expand_y=True, auto_size_text=True)],
            [Multiline(
                default_text=text, disabled=True, expand_x=True, expand_y=True, autoscroll=True,
                auto_refresh=True, auto_size_text=True, focus=True, size=(64, 16)
            )],
            [Button(button_text="Copy", expand_x=True, expand_y=True, size=(8, 1)),
             Button(button_text="Close", expand_x=True, expand_y=True, size=(8, 1))],
            [Text(text="Made By: TonicBoomerKewl", expand_x=True, expand_y=True, auto_size_text=True)]
        ])
    focus(win)
    res = win.read()
    win.close()
    if res[0] == "Copy":
        copy(prompt=prompt.strip(), text=text)
示例#19
0
 def addElementToActive(self, element: sg.Button):
     if (len(self.activeFeatures) !=
             self.nextAvailableIndex):  # not at last index.
         self.activeFeatures[self.nextAvailableIndex].update(
             text=element.GetText(), visible=True)
         self.nextAvailableIndex += 1
     else:
         self.window['feedbackText'].update(
             "Can't add, max number of elements reached.")
示例#20
0
 def __init__(self, funcs):
     self.window = Window('Funcionários')
     layout = [
         [Text('Funcionários:')],
     ]
     for func in funcs:
         layout.append([Text(f'{func.matricula} - {func.nome}')])
     layout.append([Button('Voltar')])
     self.window.layout(layout)
示例#21
0
文件: screens.py 项目: cavrau/aps
 def __init__(self, _list: List):
     layout = [[Text(f'Título: {_list.title}')],
               [Text(f'Descrição: {_list.description}')],
               [Text(f'Created: {_list.created}')], [Text('Items: ')]]
     for item in _list.items.values():
         layout += [
             [Text(f'Título: {item.title}')],
         ]
         layout += [
             [Text(f'Comentário: {item.rating.comment}')],
             [Text(f'Nota: {item.rating.grade}')]
         ] if hasattr(item, 'rating') and item.rating is not None else []
     self.window = Window(f'Detalhes da lista: {_list.title}').layout(
         layout + [[
             Button('Voltar'),
             Button('Remover Item da lista'),
             Button('Deletar lista'),
             Button('Editar lista')
         ]])
示例#22
0
    def get_render_args(self) -> tuple[list[list[Element]], dict[str, Any]]:
        if self.type == PathPromptType.DIR:
            browse = FolderBrowse(initial_folder=self.init_dir)
        else:
            kwargs = {'file_types': self.file_types, 'initial_folder': self.init_dir}
            if self.type == PathPromptType.SAVE:
                browse = SaveAs(default_extension=self.ext, **kwargs)
            elif self.type == PathPromptType.MULTI:
                browse = FilesBrowse(files_delimiter=';', **kwargs)
            elif self.type == PathPromptType.FILE:
                browse = FileBrowse(**kwargs)
            else:
                raise ValueError(f'Unexpected prompt type={self.type!r}')

        layout = [
            [Text(self.prompt, auto_size_text=True)],
            [ExtInput(default_text=self.init_path, key='_INPUT_'), browse],
            [Button('OK', size=(6, 1), bind_return_key=True), Button('Cancel', size=(6, 1))]
        ]
        return layout, {'title': self.title or self.prompt, 'auto_size_text': True}
示例#23
0
    def Login(self):
        login_active = True
        layout = [
            [T("Xpnsit", **heading_format)],
            [T("Username:"******"user")],
            [T("Password:"******"pass", password_char='*')],
            [Button("Login", bind_return_key=True), Button("Signup")]
        ]

        win = Window("Xpnsit", layout=layout)

        while login_active:  # <------------ Event Loop -----------------> #
            event, values = win.Read()

            if event is None:
                print("Exiting event loop")
                login_active = False
                self.app_state = False
                win.close()
                del win
                break

            if event == "Login":
                success = check_login_info(values["user"], values["pass"])

                if success == True:
                    print("Login Successful.")

                    self.user_details = get_user_details(values["user"])
                    self.user = NewUser(*self.user_details)

                    win.close()

                    self.Interface()
                    login_active = False
                else:
                    PopupError(
                        "ERROR: Username or password incorrect.\nPlease try again.")

            if event == "Signup":
                self.Signup()
示例#24
0
 def __init__(self):
     self.window = Window('Menu Funcionários').layout(
         [
             [Text('O que você deseja fazer?')],
             [Text('Adicionar funcionário'), Button('0')],
             [Text('Remover funcionário'), Button('1')],
             [Text('Atualizar funcionário'), Button('2')],
             [Text('Obter funcionários cadastrados'), Button('3')],
             [Text('Detalhes do funcionário'), Button('4')],
             [Text('Adicionar veículo à funcionário'), Button('5')],
             [Text('Remover veículo de funcionário'), Button('6')],
             [Button('Voltar')]
         ]
     )
示例#25
0
def value_ele(value: Any,
              val_key: str,
              disabled: bool,
              list_width: int = 30,
              no_add: bool = False,
              **kwargs) -> Element:
    if isinstance(value, bool):
        val_ele = Checkbox('',
                           default=value,
                           key=val_key,
                           disabled=disabled,
                           pad=(0, 0),
                           **kwargs)
    elif isinstance(value, list):
        kwargs.setdefault('tooltip', 'Unselected items will not be saved')
        add_button = not no_add and val_key.startswith('val::')
        if not add_button:
            kwargs.setdefault('pad', (6, 0))
        val_ele = Listbox(
            value,
            default_values=value,
            key=val_key,
            disabled=disabled,
            size=(list_width, len(value)),
            no_scrollbar=True,
            select_mode='extended',  # extended, browse, single, multiple
            **kwargs,
        )
        if add_button:
            val_ele = Column(
                [[
                    val_ele,
                    Button('Add...',
                           key=val_key.replace('val::', 'add::', 1),
                           disabled=disabled,
                           pad=(0, 0))
                ]],
                key=f'col::{val_key}',
                pad=(0, 0),
                vertical_alignment='center',
                justification='center',
                expand_y=True,
                expand_x=True,
            )
    else:
        val_ele = ExtInput(value,
                           key=val_key,
                           disabled=disabled,
                           right_click_menu=SearchMenu(),
                           **kwargs)

    return val_ele
示例#26
0
def ViewGUI():
    sg.theme('LightGreen')

    col1 = Column([
        [Frame('base function',[[Column([[
                        Text(r'VideoFile',size=(10,1)),
                        InputText(''*15, key="VideoFile"),
                        FileBrowse(target='VideoFile', size=(10,1)),
                        Button('start',key='start', size=(10,1)),
                        Button('stop',key='stop', size=(10,1)),
                        Button('Exit',key= 'exit', size=(10,1)),]],
                   size=(800,45), pad=(0, 0))]])],
        [Frame('videoplay',[[Column([[Image(filename='', key='image',)]],
                   size=(800,500), pad=(0, 0))
               ]])]
    ], pad=(0,0))


    col2 = Column([
        [Frame('results',
               [[Column(
                   [
                       [Image(filename='', key='image1', size=(200,100)), Button('view', size=(6,1)), Button('close', size=(6,1))],
                       [Image(filename='', key='image2', size=(200,100)), Button('view', size=(6,1)), Button('close', size=(6,1))],
                       [Image(filename='', key='image3', size=(200,100)), Button('view', size=(6,1)), Button('close', size=(6,1))],
                       [Image(filename='', key='image4', size=(200,100)), Button('view', size=(6,1)), Button('close', size=(6,1))],
                       [Image(filename='', key='image5', size=(200,100)), Button('view', size=(6,1)), Button('close', size=(6,1))],
                   ]
               ,size=(400,560))
                 ]]
               )]
    ])

    layout = [[col1,col2]]
    # layout = [
    #     [sg.Text(r'机器视觉原型系统', size=(40,1), justification='center')],
    #     [sg.Text(r'VideoFile',size=(10,1)), sg.InputText(''*30, key="VideoFile"), sg.FileBrowse(size=(10,1)),
    #      sg.Button('start',key='start', size=(10,1)), sg.Button('stop',key='stop', size=(10,1)), sg.Button('end', key='end', size=(10,1)),
    #      sg.Button('Exit',key= 'exit', size=(10,1))],
    #     [sg.Image(filename='', key='image')],
    # ]

    window = sg.Window(
        '机器视觉',
        layout,
        location=(100,100),
        finalize=True
    )
    return window
示例#27
0
    def _generate_layout(
            self,
            disable_all: bool) -> Iterator[tuple[Optional[int], int, Element]]:
        for name, opt in self.options.items():
            opt_type, col_num, row_num = opt['opt_type'], opt['col'], opt[
                'row']
            val = opt.get('value', opt['default'])
            disabled = disable_all or opt['disabled']
            common = {'key': f'opt::{name}', 'disabled': disabled}
            if opt_kwargs := opt.get('kwargs'):
                common.update(opt_kwargs)
            for param in COMMON_PARAMS:
                try:
                    common[param] = opt[param]
                except KeyError:
                    pass

            if opt_type == 'checkbox':
                yield col_num, row_num, Checkbox(opt['label'],
                                                 default=val,
                                                 **common)
            elif opt_type == 'input':
                yield col_num, row_num, Text(opt['label'], key=f'lbl::{name}')
                yield col_num, row_num, ExtInput('' if val is _NotSet else val,
                                                 **common)
            elif opt_type == 'dropdown':
                yield col_num, row_num, Text(opt['label'], key=f'lbl::{name}')
                yield col_num, row_num, Combo(opt['choices'],
                                              default_value=val,
                                              **common)
            elif opt_type == 'listbox':
                choices = opt['choices']
                yield col_num, row_num, Text(opt['label'], key=f'lbl::{name}')
                yield col_num, row_num, Listbox(choices,
                                                default_values=val or choices,
                                                no_scrollbar=True,
                                                select_mode=opt['select_mode'],
                                                **common)
                if opt['extendable']:
                    yield col_num, row_num, Button('Add...',
                                                   key=f'btn::{name}',
                                                   disabled=disabled)
            elif opt_type == 'path':
                val = val.as_posix() if isinstance(
                    val, Path) else None if val is _NotSet else val
                yield col_num, row_num, Text(opt['label'], key=f'lbl::{name}')
                yield col_num, row_num, ExtInput('' if val is None else val,
                                                 **common)
                yield col_num, row_num, opt['button_func'](initial_folder=val)
            else:
                raise ValueError(f'Unsupported {opt_type=!r}')
示例#28
0
    def get_render_args(self) -> RenderArgs:
        full_layout, kwargs = super().get_render_args()
        search = Button('Search', bind_return_key=True)
        layout = [
            [self.options.as_frame()],
            [
                Text('Section:'), self.section_picker, self.type_picker,
                Text('Query:'), self.query, search
            ],
            # [],  # TODO: Page chooser / back/next
            [self.results],
        ]

        full_layout.extend(layout)
        return full_layout, kwargs
示例#29
0
def getLongInput(prompt: str, text: str) -> str:
    win: Window = Window(alpha_channel=0.8, finalize=True, debugger_enabled=False, resizable=True,
                         text_justification="center", title=prompt.strip(), no_titlebar=True, keep_on_top=True,
                         disable_close=True, disable_minimize=True, grab_anywhere=True, auto_size_text=True, layout=[
            [Text(text=prompt.strip(), expand_x=True, expand_y=True, auto_size_text=True)],
            [Multiline(
                default_text='', disabled=False, expand_x=True, expand_y=True, autoscroll=True,
                auto_refresh=True, auto_size_text=True, focus=True, size=(64, 16)
            )], # Made By: TonicBoomerKewl (AKA DarkOctet)
            [Button(button_text=text.strip(), expand_x=True, expand_y=True, auto_size_button=True)],
            [Text(text="Made By: TonicBoomerKewl", expand_x=True, expand_y=True, auto_size_text=True)]
        ])
    focus(win)
    res = win.read()
    win.close()
    return res[1].get(0, '').strip()
示例#30
0
文件: screens.py 项目: cavrau/aps
 def __init__(self, movies, page):
     if len(movies) == 0:
         layout = [[Text('Não há filmes')],
                   [Button('Página Anterior' if page != 1 else 'Ok')]]
     else:
         layout = [[
             Button(movie.get('Title'))
             if isinstance(movie, dict) else Button(movie.title)
         ] for movie in movies]
         layout += [[Button('Página Anterior'),
                     Button('Próxima Página')]
                    if page != 0 else [Button('Próxima Página')]]
     self.window = Window('Selecionar Filme').layout(layout)