Feature > globals().update()

Also see :


Examples :

Following is a script that does not use globals().update() . When Feature > Add Functions > Dialog box was used to create this script, the " Return dictionary name " was left blank.

# Opens a dialog, prints the integer that the user enters.
# dialog begin
from dialog import Dialog
from dialog.entry import IntEntry
Dlg0 = Dialog( "Enter an Integer, See it Printed" )
Entry1 = IntEntry( Dlg0, "int_name", label="Integer:", default=1 )
Dlg0.done() # dialog end
print("Integer is", Dlg0.int_name)

This next parametric does use globals().update() . To get this example, dd was entered as the " Return dictionary name ." Note that dd is entered inside the second set of parentheses of globals().update(dd) .

# Opens a dialog and prints the user's entries to that dialog.
# dialog begin
from dialog import Dialog
from dialog.entry import IntEntry
Dlg0 = Dialog( "Enter an Integer, See it Printed" )
Entry1 = IntEntry( Dlg0, "int_name", label="Integer:",
      default=1 )
dd = Dlg0.done()               # creates a dictionary named dd
# dialog end
globals().update(dd)          # dd is entered in parentheses
print("Integer is", int_name)

Since globals().update(dd) is used in the second example, the integer that the user enters can be returned using int_name instead of Dlg0.int_name . If int_name had been used in the first example, that first script would have produced an error.