Hey all ... Well I've finally found some time to start trying to develop stuff for the N900, but there are some things which are confusing me which I need some assistance on ... Firstly, I see there are two ways I can program for the N900: C++ and Python ... I've heard devloping using Python is somewhat easier, but since I dont know python and have been using c++ for 6-7 years now, I think C++ is the better option here ... Do you agree ?
#!/usr/bin/python # Convenience imports from PyQt4.QtCore import * from PyQt4.QtGui import * import sys # This is a decorator class class WinUi: # With only one function to decorate a window def setupUi(self, parent): self.centralwidget=QWidget(parent) parent.setCentralWidget(self.centralwidget) # A horizontal layout self.layout=QHBoxLayout(self.centralwidget) # With three items self.label=QLabel("Name:", self.centralwidget) self.txt=QLineEdit(self.centralwidget) self.but=QPushButton(self.centralwidget) l=self.layout # Add them to the layout l.addWidget(self.label) l.addWidget(self.txt) l.addWidget(self.but) # Se the label of the button self.but.setText("OK") class Win(QMainWindow): def __init__(self): QMainWindow.__init__(self) # Setup the UI using the decorator class self.ui=WinUi() self.ui.setupUi(self) # Connect the mouse "clicked" event to a function self.ui.but.clicked.connect(self.click) def click(self): txt=self.ui.txt.text() if txt=='': QMessageBox.critical(self, "Error", "Please type something") else: QMessageBox.information(self, "Success", "You typed: %s" % txt) # Standard things # Create an application then create a window. # Show the window and run the main loop app=QApplication(sys.argv) win=Win() win.show() app.exec_()
python myfile.py