Bug (or gotcha) in KnobCtrl

Group:

The ticks on a KnobCtrl are incorrect if you make a call to SetTags() before SetAngularRange(), unless OnSize() is called, implicitly via an event or manually.

Attached is a script that reproduces the problem.

knob_bug.py (960 Bytes)

Hi,

Group:

The ticks on a KnobCtrl are incorrect if you make a call to SetTags() before
SetAngularRange(), unless OnSize() is called, implicitly via an event or
manually.

This is a bit curious, as the code in KnobCtrl does exactly this:

    def SetTags(self, tags):
        """
        Sets the tags for L{KnobCtrl}.

        :param `tags`: a list of integers ranging from `minvalue` to `maxvalue`.
        """

        self._tags = tags
        if min(tags) < self._minvalue:
            self._minvalue = min(tags)

        if max(tags) > self._maxvalue:
            self._maxvalue = max(tags)

        self.OnSize(None)

And your sample works perfectly for me. I don't need to
comment/uncomment any line. What version of KnobCtrl are you using? Is
the AGW from SVN? Platform? wxPython version?

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

ยทยทยท

On 23 February 2012 14:11, Const wrote:

Attached is a screen capture that shows the problem. Compare the left and right knobs: they should be the same.

Environment info:

  • Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
  • Windows XP
  • wxPython 2.8.12.1
  • File wx/lib/agw/knobctrl.py: Andrea Gavana, @ 03 Nov 2006, Latest Revision: 14 Apr 2010, 12.00 GMT

knobctrl_bug.png