import FreeCADGui # Get the main window main_win = FreeCADGui.getMainWindow() # Do something with the window main_win.setWindowTitle("My Title")
import FreeCADGui # Get the main window main_win = FreeCADGui.getMainWindow() # Create a new toolbar tb = main_win.addToolBar("My Toolbar") tb.setFloatable(False) tb.setMovable(False) # Add a button to the toolbar action = QtGui.QAction(QtGui.QIcon(":icons/document-new.svg"),"New Document", mainWindow) action.triggered.connect(open_new_document) tb.addAction(action)In this example, we use the addToolBar function to create a new toolbar and add it to the main window. We also use the setFloatable and setMovable functions to disable the ability to move and float the toolbar. Finally, we add a new button to the toolbar using the addAction function. Package library: PyQt5 or PySide2. The FreeCADGui library uses either PyQt5 or PySide2 as its backend library for building GUI applications.