Add the code shown on line 17 to the GUI we used in the previous recipe, How to get data from a widget, creating a module-level global variable. We use the C-style all uppercase convention, which is not truly Pythonic, but I think this does emphasize the principle we are addressing in this recipe:
Running the code results in a printout of the global. Note 42 being printed to the Eclipse console:
GUI_const_42_print.py