简体   繁体   English

如何使用TraitsUI和Qt5制作进度条?

[英]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, 过去,我使用traitsui.wx.themed_slider_editor.ThemedSliderEditor通过带有wx后端的TraitsUI应用程序来构建进度条,

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? 带有QT5后端的进度栏有哪些选项? I see there is this https://github.com/enthought/traitsui/blob/master/traitsui/qt4/progress_editor.py but it seems to be for Qt4. 我看到有这个https://github.com/enthought/traitsui/blob/master/traitsui/qt4/progress_editor.py,但这似乎是针对Qt4的。 So I'm not too sure how to continue? 所以我不太确定如何继续?

Qt5 should be supported. 应该支持Qt5。 See https://github.com/enthought/traitsui/blob/master/CHANGES.txt . 参见https://github.com/enthought/traitsui/blob/master/CHANGES.txt If you encounter problems with this, please open an issue on GH. 如果您遇到此问题,请在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'
                )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM