Jump to content

Acção ao clicar botão de formulário em PyQt5


Mário Neutel

Recommended Posts

Boas,

Desenhei um widget no Desginer do Qt, e converti para python, e recorrendo ao tutorial, consigo executar o widget (duas textbox, 1 botão e um label). A ideia é somar o conteúdo das caixas, pressionar o botão e exibir o resultado numa label.

No entanto, só consigo correr a widget, não sei como ler as caixas de texto nem como associar código ao clicar do botão.

O código que corre o widget é o seguinte:

from PyQt5 import uic 

from PyQt5.QtWidgets import QApplication 

Form, Window, Button = uic.loadUiType("PYQT_TUTORIAL.ui") 

app = QApplication([]) 

window = Window() 

form = Form() 

form.setupUi(window) 

window.show() 

app.exec_()

Obrigado pela ajuda, cumprimentos.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.