hi, this is my first try with PyQt so i'm trying to get a simple app to work with 1 button and 1 textbox. I tried many ways till finally get the UI to display correctly, but now i don't know where or how to define the behaviour of the button. I got the Signal/Slot thing to work with the Exit option in the menubar, but how do i define other behaviour not present in the Signal/Slot Edition window? (i think that dissapeared after Qt Designer 3.x).
Other Questions:
1.- What to define in the subclass? Controls (button, linEdit, combobox)? or Methods (on_button_clicked)?
2.- How?? (Qobjedt.connect......??)
3.- Here is my code...the main idea is just to get some text to the textbox on button_clicked(). I've read many PyQt Documentation, the reference guide, old versions docs, etc. I guess i'm the problem
.
import sys
from PyQt4.Qt import *
from ui import Ui_Main
#this is the subclass that processes idk what rlly.... :confused:
class MainWindow(QMainWindow):
def __init__(self, win_parent = None):
QMainWindow.__init__(self, win_parent)
#I don't think this on_boton_clicked it's correct, but it does work....:o
def on_Boton_clicked(self):
print "Clicked"
if __name__ == '__main__':
app = QApplication(sys.argv)
window = MainWindow()
ui = Ui_Main()
ui.setupUi(window)
window.show()
sys.exit(app.exec_())
app.exec_loop()
import sys
from PyQt4.Qt import *
from ui import Ui_Main
#this is the subclass that processes idk what rlly.... :confused:
class MainWindow(QMainWindow):
def __init__(self, win_parent = None):
QMainWindow.__init__(self, win_parent)
#I don't think this on_boton_clicked it's correct, but it does work....:o
def on_Boton_clicked(self):
print "Clicked"
if __name__ == '__main__':
app = QApplication(sys.argv)
window = MainWindow()
ui = Ui_Main()
ui.setupUi(window)
window.show()
sys.exit(app.exec_())
app.exec_loop()
To copy to clipboard, switch view to plain text mode
TY in Advance.
Bookmarks