Пример #1
0
class View(TKUtils.obter_janela()):
    def __init__(self):
        super().__init__()

        self.defs.cnf['icon'] = ICONE_MAIN
        self.defs.cnf['title'] = 'StuKi®'
        self.defs.cnf['geometry'] = '960x490'

        self.navbar = Navbar()

        self.home = Home()
        self.aluno = Aluno()
        self.grupo = Grupo()
        self.sobre = Sobre()
        self.atividade = Atividade()

        self.janela_erro = JanelaDeErro()

        self.container_ativo = ''

    def iniciar(self):
        super().iniciar()

        self.navbar.iniciar(master=self)

        self.home.iniciar(master=self)
        self.aluno.iniciar(master=self)
        self.grupo.iniciar(master=self)
        self.sobre.iniciar(master=self)
        self.atividade.iniciar(master=self)

        self.mostrar_container('home')

    def mostrar_container(self, container):
        getattr(self, container).mostrar()

        self.navbar.desativar_(container)
        self.container_ativo = container

    def ocultar_container_ativo(self):
        getattr(self, self.container_ativo).ocultar()

        self.container_ativo = ''
Пример #2
0
class JanelaDeCadastro(TKUtils.obter_janela()):
    def __init__(self, campos: int = 2) -> None:
        super().__init__()

        self.defs.qtd_campos = campos
        self.defs.cnf['geometry'] = f'420x{180 + campos * 30}'

        self.subelemento.cancelar = TKUtils.obter_botao()
        self.subelemento.confirmar = TKUtils.obter_botao()

    def iniciar(self) -> None:
        super().iniciar()

        self.criar_botao_cancelar()
        self.criar_botao_confirmar()

    def criar_botao_cancelar(self) -> None:
        self.subelemento.cancelar.defs.cnf['text'] = 'Cancelar'
        self.subelemento.cancelar.defs.cnf['bg'] = 'red'

        self.subelemento.cancelar.defs.grid['row'] = self.defs.qtd_campos
        self.subelemento.cancelar.defs.grid['column'] = 0
        self.subelemento.cancelar.defs.grid['pady'] = 100
        self.subelemento.cancelar.defs.grid['sticky'] = 'W'

        self.subelemento.cancelar.iniciar(master=self.subelemento.main)

    def criar_botao_confirmar(self) -> None:
        self.subelemento.confirmar.defs.cnf['text'] = 'Confirmar'
        self.subelemento.confirmar.defs.cnf['bg'] = 'green'

        self.subelemento.confirmar.defs.grid['row'] = self.defs.qtd_campos
        self.subelemento.confirmar.defs.grid['column'] = 1
        self.subelemento.confirmar.defs.grid['pady'] = 100
        self.subelemento.confirmar.defs.grid['sticky'] = 'E'

        self.subelemento.confirmar.iniciar(master=self.subelemento.main)