qt5traitsenthoughttraitsui

How do make a progress bar with TraitsUI and Qt5?


In the past, I used the traitsui.wx.themed_slider_editor.ThemedSliderEditor to build a progress bar with a TraitsUI application with wx backend,

Item("model.progress",
      label="Progress",
      show_label=False,
      style='readonly',
      editor=ThemedSliderEditor(low=0.0,
                                high=1.0,
                                increment=0.05,
                                show_value=False))

What are the options for a progress bar with a QT5 backend? I see there is this https://github.com/enthought/traitsui/blob/master/traitsui/qt4/progress_editor.py but it seems to be for Qt4. So I'm not too sure how to continue?


Solution

  • Qt5 should be supported. See https://github.com/enthought/traitsui/blob/master/CHANGES.txt. If you encounter problems with this, please open an issue on GH.


    Update:

    Try something like this (partial, not tested):

    from traitsui.editors import ProgressEditor
    (other imports etc)...
    
    class ProgressDialog(HasTraits):
        progress = Int
        view = View(Item('progress', show_label=False,
                         editor=ProgressEditor(min=0, max=100)),
                    title='Progress'
                    )