How to open a new Window in Pyside2?

Asked

Viewed 41 times

0

I was using a stop function to open the windows in a kind of window manager. At the top of the class I leave the menu = False, and when it becomes True in the function, it is for the window to open, but I do not know if this way is correct.

Follow the code that calls the window:

    def login(self):
    global menu

    #CHAMAR BANCO DE DADOS DE LOGIN
    u = Users()

    #COLETANDO DADOS
    operador = txt_usuario.text()
    senha = txt_senha.text()
    entrar = u.selectOperador(operador,senha)

    #VERIFICANDO DADOS
    if entrar == 'Operador conectado':
        menu = True
        self.close()

Follow the 'Window Manager' code, which in this case is another python file made exclusively for this:

import OxMuscle as vl
import sys
import cadastro as c
import menu as m

def carrega_sistema():
    #TENHO IMPRESSÃO QUE O PROBLEMA SEGUE AQUI, JÁ QUE SEMPRE QUE FECHO A JANELA NO "X", AS RESPECTIVAS JANELAS SÃO ABERTAS EM SEGUIDA
    vl.executa()
    menu = m.executa()
    cadastro = c.executa()

    if cadastro:
        c.executa()


    if menu:
        m.executa()

carrega_sistema()

sys.exit(0)

If you find all the codes necessary, please let me know that I post here

  • Have you seen this tutorial?

  • I saw it, but the goal is not to open a window in the same python file, but to open a window created in another file. For example: I am in Oxmuscle.py and there was built a login window, when clicking enter I want to call the Window that was created in menu.py, I could understand?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.