I’m venturing into making a script for the Deadline Monitor and I want to display an image in a box. Python is not my forté currently. I’ve done some digging and found this example of how to use pyQT with Deadline, which works.
Has anyone got a snippet to put an image control in? Doesn’t appear to be that simple and I can find dozens of different examples in Python for making image controls, but so far I’ve got none of them to work.
[code]from PyQt4.QtCore import *
from PyQt4.QtGui import *
########################################################################
Globals
########################################################################
dialog = None
########################################################################
Custom QDialog with some basic controls.
########################################################################
class CustomQtDialog(QDialog):
def init(self, parent=None):
super( CustomQtDialog, self ).init( parent )
#set the main layout as a vertical one
self.mainLayout = QVBoxLayout()
self.setLayout( self.mainLayout )
#a label to display stuff
self.displayLabel = QLabel( "Click a button!" )
self.mainLayout.addWidget( self.displayLabel )
#this horizontal layout will contain a bunch of buttons
self.buttonLayout = QHBoxLayout()
self.button1 = QPushButton( "1" )
self.buttonLayout.addWidget( self.button1 )
self.button2 = QPushButton( "2" )
self.buttonLayout.addWidget( self.button2 )
self.closeButton = QPushButton( "Close" )
self.buttonLayout.addWidget( self.closeButton )
self.mainLayout.addLayout( self.buttonLayout )
#hook up the button signals to our slots
self.button1.clicked.connect( self.button1Pressed )
self.button2.clicked.connect( self.button2Pressed )
self.closeButton.clicked.connect( self.closeButtonPressed )
@pyqtSlot( bool )
def button1Pressed( self, checked ):
self.displayLabel.setText( “You pressed the first button!” )
@pyqtSot( bool )
def buttlon2Pressed( self, checked ):
self.displayLabel.setText( “You pressed the second button!” )
@pyqtSlot( bool )
def closeButtonPressed( self, checked ):
self.done( 0 )
########################################################################
Main Function Called By Deadline
########################################################################
def main():
global dialog
#Create an instance of our custom dialog, and show it
dialog = CustomQtDialog()
dialog.setVisible( True )[/code]