python - wxPython slider : Some module attributes appear to be missing

标签 python wxpython

当我运行此 wxPython 代码时:

        self.pwm_duty_cycle_slider = wx.Slider(self.panel, id=wx.ID_ANY,
                                           value=60, minValue=5,
                                           maxValue=95,
                                           style=wx.SL_VALUES)

编译没有错误。

但是,当我改变时

      style=wx.SL_VALUES

      style=wx.SL_VALUE_LABEL

我得到这个回溯:

Traceback (most recent call last):
      File "C:\Users\Daniel\GitHub\FiberDrill\fiberdrill\gui.py", line 112, in on_laseroption
        LaserOptionDialog(self)
      File "C:\Users\Daniel\Documents\GitHub\FiberDrill\fiberdrill\gui.py", line 246, in __init__
        style=wx.SL_VALUE_LABEL)
    AttributeError: 'module' object has no attribute 'SL_VALUE_LABEL'

我有点困惑,因为根据the wxPython documentation wx.SL_VALUE_LABEL 应该是一个有效的属性。

作为引用,我使用 Enthought Canopy Python 2.7.3(64 位)和 wxPython 2.8.10.1

最佳答案

看起来该属性是在 2.9 中添加的。查看旧的 2.8 文档(此处的精美版本: http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.Slider.html )您会发现它不在列表中。您链接到的文档是 Phoenix 文档,因此这绝对意味着它存在于 Phoenix 中。我刚刚使用 2.9.3.1(经典)进行了测试,它也在那里。看来您需要升级。

顺便说一句,2.9系列没有任何问题。 wxPython 的创建者说,在很多方面,它甚至比 2.8 左右更稳定。然而,Phoenix 版本还没有准备好投入生产,并且只是测试版质量。如果你升级的话我会坚持经典。

关于python - wxPython slider : Some module attributes appear to be missing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17684241/

相关文章:

python - BeautifulSoup Replace_with 用于非标准标签

python - 如何让wxpython在单元测试中捕获线程事件?

python - 在 wxPython 中调整父级大小时重新缩放图像

python - 没有 Xcode 的 PyObjC 教程

python - 使用 lambda 的 Telegram 机器人 message_handler

python - Pandas:基于DataFrame中的其他列在DataFrame中创建新列

python - 在元组列表中按字母对数字求和

python - 从列表中删除元组

python - Pyinstaller:创建具有多个依赖项的可执行文件 - "TypeError"

python - 如何在 Travis CI 上构建 MacOSX 可执行文件?