Seite 1 von 1
QT in Python?
Verfasst: Mittwoch 15. Juni 2005, 16:12
von notebook20000
Hallo,
habe jetzt mit QT eine Oberfläche erstellt und pyuic in Pythoncode konvertiert.
Wie spreche ich nun die Oberfläche an ?
mit
f = MaiNWindow() passiert nix:( Das ist die Klasse der QT Datei
Verfasst: Mittwoch 15. Juni 2005, 17:17
von Leonidas
Was für einen Typ hat MaiNWindow?
Ansonsten noch einen alten Quellcode von mir:
Code: Alles auswählen
#!/usr/bin/env python
# -*- encoding: latin-1 -*-
import sys
import qtwrap as qt
class TextApplication(object):
def __init__(self, argv):
self.app = qt.Application(argv)
self.te = qt.TextEdit()
self.app.setMainWidget(self.te)
self.te.show()
def load(self):
self.te.setText('Loaded')
def run(self):
sys.exit(self.app.exec_loop())
def main():
ta = TextApplication(sys.argv)
ta.load()
ta.run()
if __name__ == '__main__':
main()
Der funktioniert zwar ohne Qtwrap nicht, aber er demonstriert das konzept: Es wird eine QApplication geöffnet, das dann in der exec_loop laufen gelassen wird.