Skip to content

Commit

Permalink
ENH: We do not yet support changing the color, so change color to prop
Browse files Browse the repository at this point in the history
  • Loading branch information
hoechenberger committed Aug 15, 2018
1 parent 6f230c8 commit 60973ef
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions psychopy/tests/test_all_visual/test_slider.py
Expand Up @@ -3,6 +3,8 @@

from __future__ import division

import pytest

from psychopy.visual.window import Window
from psychopy.visual.slider import Slider

Expand All @@ -28,3 +30,9 @@ def test_color(self):
assert l.color == color

del s

def test_change_color(self):
s = Slider(self.win)

with pytest.raises(AttributeError):
s.color = 'blue'
7 changes: 6 additions & 1 deletion psychopy/visual/slider.py
Expand Up @@ -149,7 +149,7 @@ def __init__(self,
self.flip = flip
self.granularity = granularity
self.textSize = textSize
self.color = color
self._color = color
self.font = font
self.autoDraw = autoDraw
self.depth = depth
Expand Down Expand Up @@ -215,6 +215,11 @@ def horiz(self):
"""(readonly) determines from self.size whether the scale is horizontal"""
return self.size[0] > self.size[1]

@property
def color(self):
""" Color of the line/ticks/labels according to the color space.
"""
return self._color

def reset(self):
"""Resets the slider to its starting state (so that it can be restarted
Expand Down

0 comments on commit 60973ef

Please sign in to comment.