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

164 questions
2
votes
0 answers

python-traitsui. Update property before completion of button fired

I am trying to get a property and GUI to update before the end of a button fired action. I feel like this should be straightforward but I am missing an update command or something. The portion of the code is below: item1 = Property(Str, depends_on =…
2
votes
0 answers

Creating a classic menu bar in TraitsUI

All of the tutorials I have encountered thus far focus on the use of TraitsUI widgets. I would like to find an example of using TraitsUI for an application window with a full-width 'classic' top horizontal menu bar (with a 'File' menu, for 'Open',…
srk
  • 151
  • 5
2
votes
1 answer

Mayavi: Get array index from picker object

In the mayavi application coded below I'm trying to obtain the array index of the plotted example data set. I'm following the picker example on the web very closely but in this class implementation it doesn't seem to work, see the code comments…
TheCat
  • 105
  • 4
2
votes
0 answers

Python: Traits GUI dark background

When opening a traitsui window the background of the window is dark instead of light (see attached screenshot). I just tried a minimal example: from traits.api import HasTraits, Str, Float, Range class Reservoir(HasTraits): name = Str …
C. Lab
  • 21
  • 2
2
votes
0 answers

Using TraitsUI in Mayavi to create a GUI, magnetic field simulation

I am currently working on a project that I have to simulate the magnetic field produced by a circular wire loop. I have written a piece of code and put it into a class, that works perfectly, but when I try to create a GUI using TaitsUI, it just…
nikjohn
  • 483
  • 9
  • 17
2
votes
1 answer

traits difference between writing member as Trait or Trait() ex x=Str or x=Str()

from traits.api import Str class Foo(HasTraits): a=Str b=Str() Is there any behavioral difference between members 'a' and 'b'? Are trait attributes always instance specific or can they be class members?
user3391229
  • 808
  • 8
  • 17
2
votes
1 answer

Usage of BoundsEditor in TraitsUI

I want to use the BoundsEditor (in TraitsUI) for a range selection. How do I access the High and Low values? For testing I use the RangeEditor - which works as expected (on moving the slider the current value is printed). But I cannot get any values…
M.S.
  • 23
  • 2
2
votes
1 answer

How can I make a View Item readonly AND scrollable in Enthought Traitsui?

I am using the views in Enthought Traitsui. Within a view, I am using Item('strings', enabled_when='len(x)>20'), where 'strings' is a list of strings and len(x)>20 is never true. If there are more than three strings in the list, I cannot see them…
Antique
  • 31
  • 2
2
votes
1 answer

using a method trait in a traitsui factory

I am trying to figure out how Method traits work and if I can use one in a factory defined in a traits View object in order to have dynamic values passed to the factory. Here is what I mean, a minimal test case which works except for the factory…
aestrivex
  • 4,640
  • 1
  • 23
  • 41
2
votes
1 answer

Column widths with TabularAdapters?

Using Enthought Canopy's TraitsUI, I'm using TabularAdapters to display some Arrays, but they always produce evenly proportioned column widths...I'd like to make some widths smaller than others, but haven't found any simple way yet...Anyone have any…
Steve76063
  • 197
  • 1
  • 10
2
votes
1 answer

different formats for TabularAdapter columns?

I've found that I can apply a format to ALL the columns in a TabularAdapter by adding a statement like this to the TabularAdapter declaration: format = '%7.4f'. However, I'd like to have different formatting for each column in the table...is this…
Steve76063
  • 197
  • 1
  • 10
2
votes
2 answers

Dynamic initialization of Traits Range object

I'm having trouble trying to dynamically initialize a Traits Range object. The following code is a very simple example of what I'm trying to do, but sadly fails with the following type error: TypeError: unsupported operand type(s) for -: 'int' and…
dreme
  • 3,502
  • 3
  • 15
  • 20
2
votes
1 answer

Enthought TraitsUI ValueEditor: Selecting Values

I'm using a ValueEditor (source, docs) to view a nested HasTraits object and noticed that it's not straightforward to get the selected value from this editor, as it would be for a ListEditor for example. I even tried just editing the module in my…
Adam Hughes
  • 9,853
  • 6
  • 52
  • 89
2
votes
1 answer

TraitsUI CheckListEditor with default selections?

I'm using a CheckListEditor (source, docs) to present a list of options to users for configuring a simulation. By using the custom View options, it displays these selections as checkboxes. What I can't figure out is how to set some pre-selected or…
Adam Hughes
  • 9,853
  • 6
  • 52
  • 89
2
votes
2 answers

Inspect stack of traits for TreeView?

We're trying to assess the feasibility of this idea: We have a pretty deep stack of HasTraits objects in a modeling program. For example, if we are modeling two materials, we could access various attributes on these…
Adam Hughes
  • 9,853
  • 6
  • 52
  • 89
1
2
3
10 11