Hi Felix,
thanks a lot for posting your questions here.
The Table widget can be a good widget to quickly present tabular data. However, it might be that it cannot fully customized to your needs.
Regarding your first point, you could return the data from your CustomFunction script with different variable names. This way, you would also see shorter variable names in the table column headings.
Regarding the problem with the number formatting, we will try to reproduce this as all entries should be added as string without any further formatting.
In the best case, you could then use the Table widget as is.
If you need further customization, it is possible to create own widgets using the add-on module CustomFunction.
Please update to the latest version of the module and have a look at the at the example “GUI_Pass_Fail”. This script creates a PASS/FAIL widget. It is a good example how to create a widget using Qt5/PySide2 and link it to the main function of the CustomFunction script.
If you are new to creating UI with Qt5, we can recommend to just ask ChatGPT or similar Generative AI tools. Here is an example:
from PySide2 import QtWidgets, QtCore
class TableWidget(QtWidgets.QWidget):
def __init__(self):
super().__init__()
self.layout = QtWidgets.QVBoxLayout(self)
self.table = QtWidgets.QTableWidget(30, 10) # 30 rows, 10 columns
self.layout.addWidget(self.table)
self.setLayout(self.layout)
def set_column_content(self, column_index, content_list):
"""Sets the content of a specific column."""
if 0 <= column_index < self.table.columnCount():
for row_index, value in enumerate(content_list):
if row_index < self.table.rowCount():
item = QtWidgets.QTableWidgetItem(str(value))
self.table.setItem(row_index, column_index, item)
else:
print("Invalid column index")
def set_column_headers(self, headers):
"""Sets the column headers."""
if len(headers) == self.table.columnCount():
self.table.setHorizontalHeaderLabels(headers)
else:
print("Header list must match the number of columns")
(code not tested)
Copy this widget to your CustomFunction script and link it to your loaded data.
Please find further information how to enable the GUI mode in a CustomFunction script here:
https://wiki.sweep-me.net/wiki/CustomFunction#GUI_mode
Let me know whether further infos are needed.
Best, Axel