Pass interface variables between classes

Dear developers,


I create a message box want to update the process phase of my code, I define it in Widget class, and it successfully show in interface,

But the question is I need to update the state in Logic class,

When I click apply, error showed,

So I want to know how to pass ui2 between different classes.

Best wishes,
Joshua

We often include a progressCallback option in the Logic constructor that defaults to a noop (e.g. like lambda x: None). That way the logic code can operate with no GUI, e.g. in batch mode, but when the Widget provides a function that does GUI operations the user gets feedback.

Sorry but I think I cannot understand it deeply.
I want to show in the Slicer that user can know the stage of my code.

See how it’s used here for example:

You basically have a method in the Widget class that “knows” about the GUI that gets passed into the logic where there is no access to the GUI by default. That way the logic class can be used as needed with different UI feedback or none at all.