Questions tagged [traitsui]

traitsui is a data-driven framework developed by Enthought for building user interfaces on top of traits in python.

Traitsui is a data-driven framework developed by Enthought for building user interfaces on top of traits in Python. The details of layout and organization are mostly abstracted from the programmer, although an API is exposed to manage some of the details.

In traitsui, statically-typed classes (using traits) can automatically generate interactive interfaces for manipulation. Object-oriented principles generally apply -- by specifying a Manager(HasTraits) class with traits such as salary=Int and job_title=String, traitsui can automatically generate a window to edit these attributes.

traitsui makes use of different widget-drawing toolkits, notably qt4 and Wx by means of the pyside and wxpython bindings to those frameworks. Thus the UIs developed have the look and feel of the native OS.

See the traitsui user manual for more: http://docs.enthought.com/traitsui/traitsui_user_manual/index.html

167 questions
1
vote
1 answer

How to show an objects traits when it is called from another piece of code as an instance

I am just starting out with TraitsUI, and I am beginner Python programmer. I hope this question is not too low-level. I want to display a button set up in ControlPanel, calling it from Main. When i do the following, i just a window with a button…
DanG
  • 306
  • 7
  • 15
1
vote
1 answer

Choosing from multiple Views, when using a HasTraits object in Item

Is there a way to define multiple views for a HasTraits object, and choose them when displaying them as an Item? class Person(HasTraits): first_name = String() last_name = String() formal_view = View( Item('first_name'), …
alex
  • 2,968
  • 3
  • 23
  • 25
1
vote
1 answer

adding nested HasTraits properties to a TraitsUI TView

i have a main HasTraits class which contains several Instance's of other HasTraits objects. I would like to define an Item in the view of the main object which points to a trait of a nested object. for example: class Person(HasTraits): name =…
alex
  • 2,968
  • 3
  • 23
  • 25
1
vote
1 answer

How to generate a key press event in traitsui (Mayavi)?

I have a Mayavi scene widget with a toolbar and I want to add a button with the same behaviour that pressing CTRL+C, CTRL+A (Change between camera and actor interactor mode). I think that simulating a key press event by cliking in the button is the…
Carlos
  • 95
  • 9
1
vote
1 answer

Changing the length of a table dynamically in python

I have written the following python program to choose a variable number of shapes(n=3,8,5) from a list and make and show a table with (n+1=4,9,6) upon selection of three different keys from a combobox dropdown list.The problem is that the number of…
fariborz
  • 11
  • 1
1
vote
0 answers

Python. Enthought Traits. How to get a multi-column from a spreadsheet to display on the TabularEditor?

I am trying to understand how enthought.traits and enthought.traitsui work, and so far I have found it very easy to work with. I have also looked at the example…
iLovePython
  • 261
  • 4
  • 14
1
vote
1 answer

When to use the trait Instance() constructor, and questions about the traitsUI tutorial code

I have a question regarding the traitsui tutorial by Gael Varoquaux. In code snippet 7 he makes a CaptureThread class for producing a thread for taking images from a camera. He also make a Camera class. class TextDisplay(HasTraits): string =…
labjunky
  • 831
  • 1
  • 13
  • 22
1
vote
1 answer

Finding current location of editors in traitsui

Is there a way to tell what is the current location of my editor on the screen? Also acceptable would be a way to tell what is the current location of an editor within the traitsui window in which it is situated. The use case is this: I am trying…
aestrivex
  • 5,170
  • 2
  • 27
  • 44
1
vote
1 answer

python Traits: Column of Buttons in Table

I would like to add a Button to the end of every line in a table. The following code results in an PyDeadObjectError when closing the window: from traits.api import HasTraits,Str,Int,Button,Instance from traitsui.api import…
Ben K.
  • 1,160
  • 6
  • 20
1
vote
1 answer

Enaml examples from Enthought not working with Python(x,y) Enthought Tool Suite version of Enaml

I recently discovered Enaml, a Python GUI development package from Enthought. I'm very interested in using it with Enthought Traits and Chaco for more rapid scientific application development. I've been using Python(x,y) as my base Python…
flutefreak7
  • 2,321
  • 5
  • 29
  • 39
1
vote
0 answers

Use trait options or traitui.editor factory options?

When options for a Trait are available both in the traits definition and in the traitsui.DefaultEditor for this trait, what is the recommendation for which one to use and why? E.g. the File trait has the option for a filter, which can also be…
K.-Michael Aye
  • 5,465
  • 6
  • 44
  • 56
0
votes
0 answers

Using TraitsUI ShellEditor to get notifications before and after the user hits the enter key

I'm working on a multi-threaded application and using ShellEditor to create an embedded Python terminal. I need to get a notification before and after a command has been executed in the embedded shell so I can acquire and release a threading…
Daniel Farrell
  • 9,316
  • 8
  • 39
  • 62
0
votes
1 answer

Handle nested traits changes with traits api

I am having some issues building a GUI with traits and traitsui. What I am trying to do can be simplified to the following: from traits.api import List, Str, on_trait_change, Trait, HasTraits from traitsui.api import View, Item, EnumEditor a_names…
narsonalin
  • 69
  • 5
0
votes
0 answers

Setting the view of a scene via mlab in traitsui is not working

I am trying to code a program based on traitsUI and Mayavi, but I have some problems. Following the code I am using: #!/usr/bin/env python import os from traits.api import HasTraits, Instance, String, on_trait_change from…
giammi56
  • 154
  • 1
  • 15
0
votes
1 answer

Use traitsui & wxpython

I'm trying to modify some python code which use traitsui & wxphthon, written several years ago. I want to update these traitsui & wxpython, but there are some problems.. (Environment: windows 10, python 3.7.6 32bit, traits==5.2.0 -> to the latest…
J.Elena Suh
  • 51
  • 1
  • 5