i finally started having a look at gui yesterday, and tried to do some things with PySide, however i have the following problem;
Whats wrong with this code?
!/usr/bin/python # -*- coding: utf-8 -*- import sys from PySide.QtCore import * from PySide.QtGui import * class Form(QDialog): def __init__(self, parent=None): super(Form, self).__init__(parent) # Create widgets self.edit = QLineEdit("Write my name here") self.button = QPushButton("Show Greetings") # Create layout and add widgets layout = QVBoxLayout() layout.addWidget(self.edit) layout.addWidget(self.button) # Set dialog layout self.setLayout(layout) # Add button signal to greetings slot self.button.clicked.connect(self.greetin... # Add button signal to exit slot exit_button = QPushButton("Exit") exit_button.clicked.connect(sys.exit) # Greets the user def greetings(self): print ("Hello %s" % self.edit.text()) if __name__ == '__main__': # Create the Qt Application app = QApplication(sys.argv) # Create and show the form form = Form() form.show() # Run the main Qt loop sys.exit(app.exec_())
p.s im only just started learning pyside, i dont know how to make a button to exit.
p.p.s i have been playing with python for a while now, and still dont think i know much at all, am i doing okay so far or am i really bad like i feel?!
also, i dont know if im going about this the best way, can someone give me some key progress goals to go by or something, so that i dont end up missing things or getting too far ahead too soon, for my own good.