Python application, Pyqt5, not displaying the . UI file?

Asked

Viewed 158 times

0

This program is an application to download videos from youtube, the code is working, but when I tried to call the graphical interface created in Qt Designer, it did not appear.

The code did not show any error, but is also not calling the image.

Could someone help me, please?

from PyQt5 import uic, QtWidgets

def funcao_principal():
    linha1 = Login.lineEdit.text()
    
    if Login.radioButton.isChecked():
        print("Música selecionada")
    elif Login.radioButton_2.isChecked():
         print("Vídeo selecionado")

    print("ENSIRA UM LINK:", linha1)


app = QtWidgets.QApplication([])
Login = uic.loadUi("Login.ui")
Login.pushButton_login.clicked.connect(funcao_principal)


app.exec()

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

  • 1

    Can’t you show me anything else? for example, its main function has the line1 saying q is an edit line but does not specify the object name, size, position within the window...

  • 1

    I started in the area recently, do not know much of the subject, to half lost here kk

  • 1

    That’s the least... you’re showing the preview screen in QT designer, but saved? you need a file or a template to be able to embed in your program. If you have already done it, put his code here for us

  • The answer lies just below Karllos, I hope to have helped!

  • 1

    Damn it worked, thank you very much man

1 answer

0

All the code remains correct, however, a fundamental part is to call the screen you set up to be able to interact with it, as a simple function that translates from English means show the function .show will present you the screen, now just implement.

See more in riverbankcomputing.com/Static/Docs/Pyqt5/ here is the most current version of the Pyqt5 library.

from PyQt5 import uic, QtWidgets


def funcao_principal():
    linha1 = Login.lineEdit.text()

    if Login.radioButton.isChecked():
        print("Música selecionada")
    elif Login.radioButton_2.isChecked():

    print("INSIRA O LINK: ", linha1)


app = QtWidgets.QApplication([])
Login = uic.loadUi("Login.ui")
Login.pushButton_login.clicked.connect(funcao_principal)

Login.show()  # Você esqueceu dessa etapa do código. Login.show() é o comando para a tela aparecer.
app.exec()

Browser other questions tagged

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