![]() |
2010-04-05
, 19:53
|
|
Posts: 754 |
Thanked: 630 times |
Joined on Sep 2009
@ London
|
#2
|
...
So here it is: I'm really lost! And I could do with some help. Any advice is more than welcome, and as soon as I get my app in the repo, i'll be adding some name to the "thanks to/contribution" tab
|
2010-04-06
, 01:22
|
Guest |
Posts: n/a |
Thanked: 0 times |
Joined on
|
#3
|
![]() |
2010-04-06
, 15:28
|
|
Posts: 1,366 |
Thanked: 1,185 times |
Joined on Jan 2006
|
#4
|
self.connect(MyButton, QtCore.SIGNAL('clicked()'), QtGui.qApp, MyButton-Handling Routine)
![]() |
2010-04-09
, 16:10
|
|
Posts: 3,203 |
Thanked: 1,391 times |
Joined on Nov 2009
@ Worthing, England
|
#5
|
try: from PyQt4 import QtCore, QtGui except: print "Unexpected error: Importing QtCore and QtGui" raise class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") #or whatever size you want MainWindow.resize(800, 420) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.pushButtonPlus_snd1 = QtGui.QPushButton(self) self.pushButtonPlus.setGeometry(QtCore.QRect(10, 10, 391, 51)) self.pushButtonPlus.setObjectName("pushButtonPlus") self.pushButtonPlus.setText("+") # Tell the button what to do when it is clicked. In this case i want it to run the Add a number function below QtCore.QObject.connect(self.pushButtonPlus, QtCore.SIGNAL('clicked()'), self.plusFunction) MainWindow.setCentralWidget(self.centralwidget) QtCore.QMetaObject.connectSlotsByName(MainWindow) def plusFunction(self): << Do something here?!?! - change value of a label maybe?>> if __name__ == "__main__": app = QtGui.QApplication(sys.argv) MainWindow = QtGui.QMainWindow() ui = Ui_MainWindow() ui.setupUi(MainWindow) MainWindow.show() sys.exit(app.exec_())
![]() |
2010-04-09
, 16:21
|
Posts: 249 |
Thanked: 167 times |
Joined on Mar 2010
@ International
|
#6
|
I've started learning a bit of python and Qt in order to develop my own application, this has been a bit of a goal for some time now.
I've finally got the python side working well, but i'm really struggling with the UI part.
My application is a simple "clicker" program: you can increment/decrement (by one) the current value, reset the current value to 0 and quit the application.
I know there already is a similar app on the OVI store, but this is more of a first step into developing for me.
Ideally, to do this, the program should have a "+", "-", "reset" and "quit" button and should look like something like this:
Since, Maemo (and Meego I guess) are all open open source, i dont mind sharing my code, not that it would take most of you more than 5min to do on your own!
This is it:
As you can see the code is very simple. I've tried to link the code to the UI but with very little succes:
- I can get the program to create a window,
- to get a working quit button
but
-I can't seem to link any of the buttons to a specific function
-i can't link the program to the LCD object (even though I can connect it to the slider, like in the QT documentation, but that's not really what I need)
So here it is: I'm really lost! And I could do with some help. Any advice is more than welcome, and as soon as I get my app in the repo, i'll be adding some name to the "thanks to/contribution" tab
Follow me on twitter HERE!
Applications I've made:
- Vuvuzela
- LTM: London Tube Map