enthought / qt_binder

Thinly wrap Qt widgets with Traits
Other
19 stars 5 forks source link

`TraitsUI` does not display label #43

Closed pberkes closed 8 years ago

pberkes commented 8 years ago

The TraitsUI binder does not display the label that the TraitsUI editor usually have.

For example:

from qt_binder.api import Bound, TraitsUI
from traits.api import HasStrictTraits, Int
from traitsui.api import Item, View

class NumberView(HasStrictTraits):

    number = Int

    def default_traits_view(self):
        traits_view = View(
            Bound(
                TraitsUI(
                    Item('number', label='A nice little number'),
                ),
            ),
        )
        return traits_view

if __name__ == '__main__':
    dialog = NumberView()
    dialog.configure_traits()

Produces

screen shot 2016-02-26 at 16 09 50

rkern commented 8 years ago

Intentionally. The label=... goes on the Bound in order to be laid out correctly.

rkern commented 8 years ago

Use a Form layout inside the Bound() if you want labels.

pberkes commented 8 years ago

Ok thanks closing