A form Control is a UI interface for the user to interact with the application.
Bellow we can find the description of all the Controls implemented in the PyForms library.
All the Controls inherit from this Control, therefore you can find its functions and properties in all the other controls listed below.
label - Control label.
default - Initial value of the control.
helptext - Text shown when the mouse is over the control.
Load the control UI and initiate all the events.
Loads the value of the control.
data - It is a dictionary with the required information to load the control.
path - Optional parameter that can be used to save the data.
Save a value of the control to a dictionary.
data - Dictionary where the control value should be saved.
path - Optional parameter that can be used to load the data.
Show the control.
Hide the control.
Add an option to the Control popup menu.
label - Label of the option
function_action - Optional parameter that can be used to load the data.
key - Dictionary where the control value should be saved.
icon - Optional parameter that can be used to load the data.
submenu - Parent submenu to which the option should be added. If no value is set, then the option will be added to the main popup menu.
It returns a new sub popup menu. If submenu is open the menu is added to the main popup menu.
control.add_popup_menu_option('option 0', function_action=self._do_something)
submenu1 = self._control.add_popup_submenu('menu 1')
submenu2 = self._control.add_popup_submenu('menu 2', submenu=submenu1)
control.add_popup_menu_option('option 1', function_action=self._do_something, key='Control+Q', submenu=submenu2)Function called before the Control popup menu is opened.
Function called when ever the Control value is changed. The event function should return True if the data was saved with success.
Returns or set if the control is enable or disable.
Returns the QWidget of the control.
Returns or set the tip box of the control.
Returns or sets the label of the control.
This property returns or set the name of the control.
Returns or set the parent basewidget where the Control is.
Set and return the control visibility.
This property returns or set what the control should manage or store.
default - The default value is a list containing in the first element the lower value and in the second element the upper value.
min - Defines the minimum value that can be selected.
max - Defines the maximum value that can be selected.
horizontal - Flag indicating if the Bounding slider should be draw horizontally or vertically.
Gets and sets the value of the Control. This value is a list containing in the first element the lower value and in the second element the upper value.
Gets and sets the the minimum value that can be selected in the bounding slider.
Gets and sets the the maximum value that can be selected in the bounding slider.
If True the control works only with Integer values. If False the control will return Float values.
checkable - Flag indicating if the button is checkable or not.
Because the value of this Control is a function, nothing is loaded
Because the value of this Control is a function, nothing is saved
This function simulates a click of the button.
In case the button was initiated with the flag checkable=True, it will get and set the checked state of the button.
Return or set the button icon. The value should be a path to the icon or a QtGui.QIcon object.
The value should be a pointer to function, that will be called everytime the button is pressed.
Gets and sets a boolean indicating the state of the checkbox.
Add more elements to the list. Usage:
controlVar += ('Element', True) or
controlVar += 'Element'Clear all the elements from the list.
Function called when the selection changed.
Return how many elements the list have.
Returns the Elements with which have the checkboxes checked.
Returns a list of tuples with the format [(element, check boolean flag)]
Returns the selected row index.
It gets and sets all the List values. This property receives a list where each element is a Row in the list.
controlVar.value = [('item1',True), ('item2',False), 'item3']Function called when a key is pressed.
event - Qt event variable.
Returns and sets the pointer to the function that is called when the button save is pressed.
Returns and sets the Scintilla lexer. By default the lexer is the QsciLexerPython.
Returns and sets the code text.
Add an item to the ComboBox. Items may have a value associated to it.
controlVar.add_item('Portugal', 'pt')
controlVar.add_item('Angola', 'ao')
controlVar.add_item('Moçambique', 'mz')
controlVar.add_item('Brazil')
controlVar.add_item('Cabo Verde')Clear all the items of the ComboBox.
Return the number o items in the combobox.
Search the index of an item by the name.
The same of add_item function.
controlVar += ('Portugal', 'pt')
controlVar += ('Angola', 'ao')
controlVar += ('Moçambique', 'mz')
controlVar += 'Brazil'
controlVar += 'Cabo Verde'Called when the user select an item in the combobox. index - Activated item's index.
Called when the current combobox index is changed. index - current selected index.
Called when the text is changed. text - changed text.
Called when the user passes with the mouse over an item in the combobox. index - highlighted item's index.
Returns and sets the selected index.
Returns all the items of the combobox.
It returns the selected value of the combo box.
Gets and set the current selected item text.
This control is used to select a directory.
Simulates the push of the button.
This control is used to create DockWidget.
side - Side where the dock widget should be initiated. It can assumes the values: left, right, top or bottom. order - Top-left order that the dock will assume in the application window. margin - Margin of the dock.
This Control may be used to display a BaseWidget or another Control inside.
The constructer receives only a label.
It may receive an element, or a list of elements from the types BaseWidget or BaseControl.
This control implements a timeline where it is possible to display events and graphs.
default - Default position of the pointer. min - Timeline start. max - Timeline end.
Add a new a new event.
value - Event description. The format is a tuple: ('event name', start, end) row - Row where the event will be display. color - Color of the event.
Add a new graph.
name - Graph name. data - [(frame index, value), ...] list.
Import a graph csv file.
filename - Filename to load. separator - CSV separator character. ignore_rows - Ignore the first n lines when loading the file.
Import an event file from a csv.reader cursor.
csvfile - csv.reader cursor.
csvfile = open(filename, 'U')
spamreader = csv.reader(csvfile)
control.import_csv(spamreader)Shows the graphs properties window.
Shows the graphs properties window.
Returns the events list.
Returns or sets the maximum of time that the control will handle.
Returns the index of the row which the mouse is over.
Returns a list of rows objects.
Returns a list of graphs objects.
The control may be used to select a file.
Simulates the push of the button.
Gets and sets a file path.
Displays an image or a list of images.
Redraw the image or set of images
This property receives an image path, a numpy image or a list of numpy images.
Usage:
controlVar.value = 'lena_color.png'or
controlVar.value = cv2.imread('lena_color.png', 1)or
img1 = cv2.imread('lena_color.png', 1)
img2 = cv2.imread('lena_color.png', 1)
controlVar.value = [img1, img2]Note: the value can only be set outside the constructor and the init_form function.
Displays a text.
Displays a list of values.
add_function - Function called when the add button is pressed. remove_function - Function called when the remove button is pressed.
Clear all the values from the list.
Inserts a new row with the list of values. Notes:
- It is possible to use a QWidget value.
- If the value has the attribute icon, this icon will be displayed.
Removes the row with the index.
Set the value of a specific cell.
Get the value of a specific cell.
Auto resize the rows acording to the content.
Get the current row values.
Returns the a specific cell from the QTableWidget.
Called when any of list the content is updated.
Called when ever the selection changes.
Called when a new cell is selected.
Called when the item select changed.
Called on item item double click.
Get and set the horizontal headers in the table list.
Get and set the word wrap.
Returns the number of rows.
Returns the number of columns.
Accepts a boolean indicating if should allow only the selection of the entire row or not.
Get and set a list of values.
Return the selected indexes.
Return the selected index.
Gets and sets the icon size.
Returns and sets the readonly flag for the control.
The constructer receives only a label.
Add a basewidget to the mdi area.
Usage:
controlVar += baseWidgetRemove a basewidget from the mdi area.
Usage:
controlVar -= baseWidgetBoolean flag, indicating if should show the subwindows close button or not.
min - Defines the minimum value that can be selected. max - Defines the maximum value that can be selected.
Defines the minimum value that can be selected.
Defines the maximum value that can be selected.
Returns the selected number.
Returns and sets the number of allowed decimals.
Refresh the GL scene.
Reset all the zoom and scene rotations.
Gets and sets a GL scene.
Gets the GL window width.
Gets the GL window height.
Returns and sets the background color.
Plays the video.
Stops the video.
Refresh the last painted frame.
Read the next frame and display it.
Called on double click
event - Qt event. x - Mouse x coordenate in the video. y - Mouse y coordenate in the video.
Called on when the mouse click is activated.
event - Qt event. x - Mouse x coordenate in the video. y - Mouse y coordenate in the video.
Called everytime the mouse is dragging in the video.
start_point - Drag starting point. end_point - Drag end point.
Called when the mouse ends dragging the video.
start_point - Drag starting point. end_point - Drag end point.
Called everytime a key is pressed.
event - Qt key event.
Function called before the frame is rendered. It should return a frame or a list of frames.
frame - Numpy array representing the image.
When not None, it returns a cv2.VideoCapture object.
It may receives a video file path, or a cv2.VideoCapture object.
Usage:
controlVar.value = '~/home/ricardo/video.avi'or
controlVar.value = cv2.VideoCapture('~/home/ricardo/video.avi')Sets and gets the number of flags that should be jumped on the next cycle.
Activates the 3D visualization mode. It can be usefull to produce some 3D data visualization.
Returns the current frame index.
Returns the total number of frames of a video.
Returns and sets the frame image that is beeing rendered.
Returns and sets the video FPS.
Return and set the help text that should be rendered in the video.
Width of the frame that is being displayed
Height of the frame that is being displayed
Returns True if the player is playing.
label - This is the text that will be shown in the ProgressBar.
min - Defines the minimum value that can be selected.
max - Defines the maximum value that can be selected.
Increments the progress.
Reduce the progress.
Defines the minimum value that can be selected.
Defines the maximum value that can be selected.
Current position.
min - Defines the minimum value that can be selected.
max - Defines the maximum value that can be selected.
Defines the minimum value that can be selected.
Defines the maximum value that can be selected.
Event called everytime a key is pressed.
Append text to the bottom.
Returns and sets the readonly flag for the control.
Enable or disable an item
Check if an item is enabled or disabled
It returns and receives a list of BaseWidgets.
Add an item to the root node.
Remove an item from the root node.
Add a popup menu option to all the items, or a specific item.
label - Label of the menu option. function_action - Function to be called when the option is selected. key - Option hotkey. item - Item to which the popup menu option should be applied. icon - Icon of the popup menu option. submenu - Submenu where the option will be added.
Clear all the items from the ControlTree.
Expand or close an item and their parents.
item - Option hotkey. expand - Flag indicating if the item should be expanded or closed. parents - Flag indicating if the parents of the item should be expanded or closed.
Create a new child item.
name - Name of the new item. parent - Parent item of the new item. icon - Icon of the new item.
item = control.create_child('new item')
item.key_pressed_event = self.__key_pressed_event
item.double_clicked_event = self.__double_clicked_event
def __key_pressed_event(self, event): pass
def __double_clicked_event(self): passClone the items of a ControlTree.
tree - ControlTree to clone. copy_function - Function with the arguments "copy_function(item, new_item)" and will be called everytime a new tree item is created.
Clone an item.
parent - Parent to add the clone. item - QTreeWidgetItem to clone. copy_function - Function with the arguments "copy_function(item, new_item)" and will be called everytime a new tree item is created.
Called when the item is selected and a key is pressed.
Called when an item is double clicked.
Called everytime an item is updated.
item - Updated item.
Called when ever a new item is selected.
Called an item is double clicked by the mouse.
item - The item that was double clicked.
Called when a key is pressed.
event - Qt event.
Called when new items are inserted.
parent - Parent to which the rows were inserted. start - Insertion starting row. end - Insertion ending row.
Flag that shows or hide the header.
Retrieve the selected rows.
Retrive and set the selected row.
Retrive and set the selected item.
Returns and sets the items icons size.
Repaint the points
Gets and sets a list of 2D or 3D points to display.
Set the graph legend
(True or False). Show a grid in the graph
Set the graph title
Set the x axis label.
Set the y axis label.
Set the z axis label.
Repaint the image.
Gets and sets an numpy array image with volume.
Gets and sets the colors limits.
Return the visvis object.
Gets and sets the color map to display.
It can receives the next values: CM_BONE, CM_COOL, CM_COPPER, CM_GRAY, CM_HOT, CM_HSV, CM_JET, CM_PINK, CM_AUTUMN, CM_SPRING, CM_SUMMER, CM_WINTER.
Check out VisVis documentation.
Displays a web-browser.
Gets and sets the URL of the page to load.

























