GUI elements for plots (owplotgui)

This module contains functions and classes for creating GUI elements commonly used for plots.

class OrangeWidgets.plot.owplotgui.OrientedWidget(orientation, parent)

Bases: PyQt4.QtGui.QWidget

A simple QWidget with a box layout that matches its orientation.

class OrangeWidgets.plot.owplotgui.StateButtonContainer(gui, orientation, buttons, parent, nomargin=False)

Bases: OrangeWidgets.plot.owplotgui.OrientedWidget

This class can contain any number of checkable buttons, of which only one can be selected at any time.

Parameters:
  • gui (OWPlotGUI) – Used to create containers and buttons
  • buttons (list of (int or tuple)) – A list of button identifiers to be added to this toolbar
  • orientation – The orientation of this toolbar, either Qt.Vertical or Qt.Horizontal
  • parent (QWidget) – The toolbar’s parent widget
class OrangeWidgets.plot.owplotgui.OWToolbar(gui, text, orientation, buttons, parent, nomargin=False)

Bases: OrangeWidgets.plot.owplotgui.OrientedWidget

A toolbar is a container that can contain any number of buttons.

Parameters:
  • gui (OWPlotGUI) – Used to create containers and buttons
  • text (str) – The name of this toolbar
  • orientation – The orientation of this toolbar, either Qt.Vertical or Qt.Horizontal
  • buttons (list of (int or tuple)) – A list of button identifiers to be added to this toolbar
  • parent (QWidget) – The toolbar’s parent widget
class OrangeWidgets.plot.owplotgui.OWButton(action=None, parent=None)

Bases: PyQt4.QtGui.QToolButton

A custom tool button which signal when its down state changes

class OrangeWidgets.plot.OWPlotGUI(plot)

This class contains functions to create common user interface elements (QWidgets) for configuration and interaction with the plot.

It provides shorter versions of some methods in OWGUI that are directly related to an OWPlot object.

Normally, you don’t have to construct this class manually. Instead, first create the plot, then use the OWPlot.gui attribute.

Most methods in this class have similar arguments, so they are explaned here in a single place.

Parameters:
  • widget (QWidget) – The parent widget which will contain the newly created widget.
  • id (int or tuple) – If id is an int, a button is constructed from the default table. Otherwise, id must be tuple with 5 or 6 elements. These elements are explained in the next table.
  • ids (list of id) – A list of widget identifiers
  • text (str) – The text displayed on the widget

When using widgets that are specific to your visualization and not included here, you have to provide your own widgets id’s. They are a tuple with the following members:

Parameters:
  • id (int or str) – An optional unique identifier for the widget. This is only needed if you want to retrive this widget using OWToolbar.buttons.
  • text (str) – The text to be displayed on or next to the widget
  • attr_name (str) – Name of attribute which will be set when the button is clicked. If this widget is checkable, its check state will be set according to the current value of this attribute. If this parameter is empty or None, no attribute will be read or set.
  • attr_value – The value that will be assigned to the attr_name when the button is clicked.
  • callback (str or function) – Function to be called when the button is clicked. If a string is passed as callback, a method by that name of plot will be called. If this parameter is empty or None, no function will be called
  • icon_name (str) – The filename of the icon for this widget, without the ‘.png’ suffix.
alpha_value_slider(widget)

Creates a slider that controls point transparency

animations_check_box(widget)

Creates a check box that enabled or disables animations

antialiasing_check_box(widget)

Creates a check box that toggles the Antialiasing of the plot

create_box(ids, widget, name)

Creates a QGroupBox with text name and adds it to widget. The ids argument is a list of widget ID’s that will be added to this box

menu_button(main_action_id, ids, widget)

Creates an OWButton with a popup-menu and adds it to the parent widget.

plot_settings_box(widget)

Creates a box with controls for common plot settings

point_properties_box(widget)

Creates a box with controls for common point properties. Currently, these properties are point size and transparency.

point_size_slider(widget)

Creates a slider that controls point size

show_legend_check_box(widget)

Creates a check box that shows and hides the plot legend

state_buttons(orientation, buttons, widget, nomargin=False)

This function creates a set of checkable buttons and connects them so that only one may be checked at a time.

tool_button(id, widget)

Creates an OWButton and adds it to the parent widget.

toolbar(widget, text, orientation, buttons, nomargin=False)

Creates an OWToolbar with the specified text, orientation and buttons and adds it to widget.

See also

OWToolbar