Translations:Manual:Creating interface tools/21/en

import FreeCAD,FreeCADGui,Part path_to_ui = "C:\Users\yorik\Documents\dialog.ui" class BoxTaskPanel: def __init__(self): # this will create a Qt widget from our ui file self.form = FreeCADGui.PySideUic.loadUi(path_to_ui) def accept(self): length = self.form.BoxLength.value width = self.form.BoxWidth.value height = self.form.BoxHeight.value if (length == 0) or (width == 0) or (height == 0): print("Error! None of the values can be 0!") # we bail out without doing anything return box = Part.makeBox(length,width,height) Part.show(box) FreeCADGui.Control.closeDialog panel = BoxTaskPanel FreeCADGui.Control.showDialog(panel)
 * 1) CHANGE THE LINE BELOW