First of all, hello everybody in the list.

I'm working with python + pyqt + all this stuff for a couple of months, and now, I have some important questions (for me) about the way I do my programs.

I use several windows which usually I design with qtdesigner and convert to python code with the pyuic: "pyuic -o codeqt.py codeqt.ui". All works ok but due to the size of the project I'm working now (more precisely the size it will have once I have finished ; )) I trying to do thing with order and "fine".

I will use an example: I have 2 windows (QWidgets / QDialogs is another thing that I don't know if I 'm using well). Anyway the name of the files will be file1qt.py and file2qt.py. And the name of the form, and then the name of the classes are widget1 and widget2.

I used to leave these files as it to be make modifications with the qtdesigner and do not destroy my changes in the code (is it correct??)

In the mainprogram "main.py" I start like this:

import sys
from qt import *
from file1qt import *
from file2qt import *

...
...
def f1():
        ...
        ...
...
...
...

a = QApplication(sys.argv)

w1=widget1()
w2=widget2()

w1.connect(w1.somewidget1, SIGNAL("clicked()"), somefunction)
w1.connect(w1.anotherwidget1, SIGNAL("clicked()"), anotherfunction)

w2.connect(w2.somewidget1, SIGNAL("clicked()"), somefunction2)
w2.connect(w2.anotherwidget1, SIGNAL("clicked()"), anotherfunction2)

w1.show()

a.connect(a, SIGNAL('lastWindowClosed()'), exit_program)
a.exec_loop()


My questions:
        is it correct like that???
        In fact it works, but I don't know if it is correct to make the connections of the widget2 in the main program.
        I wish make different files for each widget, and do the imports in it and also do the connections in it. But if I do that I obtain an error:
                QPaintDevice: Must construct a QApplication before a QPaintDevice.
                this occurs because I do an w2=widget2()in a file in which I haven't defined a = QApplication(sys.argv)(I suppose )

I hope I have been clear in my explanations

Thank you all very much in advance.
_______________________________________________ PyKDE mailing list [EMAIL PROTECTED] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to