2.2. qt¶
PyQt4 is a class for creating GUI elements such as buttons, user input, and file dialog boxes. They can be embedded in a custom interface generated via Qt Creator. They are generally difficult to work with; Matplotlib widgets are recommended over the PyQt4 interface where possible.
2.2.1. Opening GUI Elements¶
-
class
scisalt.qt.ButtonMsg(maintext, buttons, title=None, infotext=None)¶ Base class
PyQt4.QtGui.QMessageBoxA convenience function for creating a multi-buttion dialog box:
- title: Title of dialog box
- maintext: Prompt for user
- infotext: Further information for user
- buttons: Array of strings for buttons
-
clicked¶ Returns the index of the clicked button.
-
clickedArray¶ Returns a boolean array of which button was clicked
-
clickedButton()¶ Returns the button clicked.
-
clickedItem¶ Returns the string of the clicked button.
-
class
scisalt.qt.getDouble(title='', text='Double number:', **kwargs)¶ Base class
PyQt4.QtGui.QWidgetA convenience class for accessing
PyQt4.QtGui.QInputDialog.getDouble(title, text, **kwargs)
-
scisalt.qt.getExistingDirectory(*args, **kwargs)¶ A convenience function for
PyQt4.QtGui.QFileDialog.getExistingDirectory()Returns a string of the directory the user selects. Raises an
IOErrorexception if a directory is not chosen.*args, **kwargs passed through to
PyQt4.QtGui.QFileDialog.getExistingDirectory().
2.2.2. Helper Objects¶
-
scisalt.qt.get_app(argv=sys.argv)¶ Tries to get the current
PyQt4.QtGui.Qapplicationinstance. If it fails, creates one. This is due to the fact thatPyQt4it is only possible to create onePyQt4.QtGui.Qapplicationinstance to be created per Python execution, or Python will crash.
-
class
scisalt.qt.Rectangle(x, y, width, height, axes=None, alpha=0.5, fill=True)¶ A convenience class for specifying and accessing an instance of
matplotlib.patches.Rectangle((x, y), width, height, facecolor='w', edgecolor='r', alpha=alpha, fill=fill, axes=axes).-
patch¶
-
get_height()¶ Get the height in y
-
get_width()¶ Get the width in x
-
get_x()¶ Get the smaller x coordinate
-
get_y()¶ Get the smaller y coordinate
-
get_xy()¶ Get the smaller coordinates
(x, y)
-
set_xy()¶ Set the smaller coordinates
(x, y)
-
set_height()¶ Set the height in y
-
set_width()¶ Set the width in x
-
x0¶ The smaller x coordinate
-
x1¶ The larger x coordinate
-
y0¶ The smaller y coordinate
-
y1¶ The larger y coordinate
-