Hi,
I was wondering if anyone has a Python example of how to create a minimal UI (similar to the one used in the Bolt script), but without using Classes. Or are the Classes absolutley necessary?
It doesn't have to create geometry, just a simple UI with 2 or 3 inputs and return the entries in a Messagebox.
Thanks,
William
This is an area that is not currently documented, but needs to be.
The classes you're seeing are used to handle events which are a key part of creating a Fusion command. The standard Fusion dialogs you see are always associated with a command which means if you want to use a dialog you have to create a command. The first event handler is to get notified when your command is created (run by the user). In reaction to this you build up the dialog and then can handle events to validate the input as it's entered and set up to listen for when the command is executed. This is when the "OK" button has been clicked and the command needs to do whatever the command does.
Currently, for simple dialog input outside of a command you need to look outside of what Fusion provides and look at what's available in other libraries. Tkinter is one of these and is a GUI library that comes standard with Python. We'll be providing some samples demonstrating the use of Tking in the future.
Hi Brian, thanks for the reply.
Will PySide remain a GUI option (seeing that it ships Fusion/Spyder)? I tried a simple PySide "Hello, World!" script in Fusion and it worked.
Regards,
William
PySide provides Pythong bindings to Qt. The Qt libraries that you desribed are part of Spyder since it uses Qt for its UI. Because Fusion is installing Spyder that PySide library is being installed. Fusion also uses Qt for its UI. Because of this we can't recommend that you use Qt because of potential conflicts. All of the libraries that Fusion/Autodesk use have been renamed to avoid clashes but there's the posibility that two Qt libraries running in the same process might have some conflict and either cause you or Fusion problems. We've not done any testing to know if there are problems or not.