[Solved] Accessing FreeCAD custom widgets from Python
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
[Solved] Accessing FreeCAD custom widgets from Python
I'd like to be able to instantiate some of FreeCAD's custom widgets (those defined in Widgets.h/Widgets.cpp) from Python. Is this currently possible? (In particular, I want a UrlLabel)
-
- Veteran
- Posts: 5513
- Joined: Thu Apr 05, 2018 1:53 am
Re: Accessing FreeCAD custom widgets from Python
Code: Select all
import FreeCADGui
ui=FreeCADGui.UiLoader()
w=ui.createWidget("Gui::UrlLabel")
w.setText("Click me")
w.setUrl("http://www.freecadweb.org")
w.show()
Re: Accessing FreeCAD custom widgets from Python
I remember Draft also extensively uses 'Gui::InputField' widgets. Could give some more clues.
Re: Accessing FreeCAD custom widgets from Python
That's perfect, thanks!