In light of segregating/organising code, am lost on the best approach. The below works, with app.py imports after the MainWindow instantiation, but will that create subsequent problems, as I can't see how else things can be done (putting the imports after MainWindow is instantiated obviously gives 'main not found' from formatting.py).
app.py
from PyQt4.QtCore import *; from PyQt4.QtGui import *; from PyQt4.uic import *; from PyQt4.QtSql import *
app = QApplication(sys.argv)
class Main(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.setMaximumSize(500,500); self.showMaximized()
def test(self):
print self.sender()
main = Main()
main.show()
from ui.formatting import *
formatting.py
from PyQt4.QtCore import *; from PyQt4.QtGui import *; from PyQt4.uic import *; from PyQt4.QtSql import *
from app import main
class LineEdit(QLineEdit):
def __init__(self):
QLineEdit.__init__(self)
self.setParent(main)
self.show()
self.textChanged.connect(main.test)
lineEdit = LineEdit()
Much appreciated