QT in Python?

Python und das Qt-Toolkit, erstellen von GUIs mittels des Qt-Designers.
Antworten
notebook20000
User
Beiträge: 7
Registriert: Samstag 22. Januar 2005, 23:50

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
Leonidas
Python-Forum Veteran
Beiträge: 16025
Registriert: Freitag 20. Juni 2003, 16:30
Kontaktdaten:

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.
My god, it's full of CARs! | Leonidasvoice vs (former) Modvoice
Antworten