How to use the cruft.Ui_Cruft function in cruft

To help you get started, we’ve selected a few cruft examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kanzure / nanoengineer / src / experimental / basic-qt-app / crufty.py View on Github external
pyuic cruft.ui > cruft.py    or just    make cruft.py
to produce a class that gets inherited by Crufty.

Qt Designer won't do everything you want. You sometimes need to
manually edit the XML in cruft.ui to accomplish things that it can't
do.


"""

import sys

from cruft import Ui_Cruft
from PyQt4.Qt import *

class Crufty(QWidget, Ui_Cruft):

    def __init__(self):
        QWidget.__init__(self, None)
        self.setupUi(self)
        self.connect(self.pushButton1, SIGNAL('clicked()'), self.pushButton1_clicked)
        self.textBrowser.setPlainText('hello')
        self.show()

    def pushButton1_clicked(self):
        print self.textBrowser.toPlainText()
        self.close()

def main():
    app = QApplication(sys.argv)
    cr = Crufty()
    app.exec_()