Last active
February 16, 2016 06:32
-
-
Save oglops/903898ef4e0344176826 to your computer and use it in GitHub Desktop.
promoted widget demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
from PyQt4 import QtGui, QtCore, uic | |
import sip | |
uiFile = os.path.join(os.path.dirname(__file__), 'promote.ui') | |
# Load the ui file, and create my class | |
form_class, base_class = uic.loadUiType(uiFile) | |
class MyWindow(base_class, form_class): | |
def __init__(self, parent=None): | |
# init our ui using the MayaWindow as parent | |
super(base_class, self).__init__(parent) | |
# uic adds a function to our class called setupUi, calling this creates | |
# all the widgets from the .ui file | |
self.setupUi(self) | |
self.pushButton.setText( | |
'This is a really, long and poorly formatted runon sentence used to illustrate a point') | |
self.pushButton.setSizePolicy( | |
QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Expanding) | |
if __name__ == "__main__": | |
app = QtGui.QApplication(sys.argv) | |
win = MyWindow() | |
win.show() | |
sys.exit(app.exec_()) | |
sys.exit(app.exec_()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment