Trying the very first example in traitsui doc:
from traits.api import HasTraits, Str, Int
from traitsui.api import View, Item
import traitsui
class SimpleEmployee(HasTraits):
first_name = Str
last_name = Str
department = Str
employee_number = Str
salary = Int
view1 = View(Item(name = 'first_name'),
Item(name = 'last_name'),
Item(name = 'department'))
sam = SimpleEmployee()
sam.configure_traits(view=view1)
makes the Spyder IPython console hang, even after the UI window has been closed.
MacOSX 10.14.6, Spyder 4.0.0, Python 3.7.0, IPython 7.10.2, traitsui 6.1.3
Probably something to configure about the UI event loop, but what and how ?
The difference between the Canopy IPython console and the Spyder IPython console is that
returns
for both, but
returns
Truein Canopy IPython terminal andFalsein Spyder IPython terminal.It is necessary to patch
view_application()in traits.qt4.view_application by commenting out the lines starting a newViewApplicationinstance depending on that test. Instead of changing the original file, it is possible to run the following code:Thus, the behavior is OK in both Spyder and Canopy IPython consoles. Note that
configure_traits(kind='modal')is also OK in both.