File: _dot.py

package info (click to toggle)
python-expyriment 0.7.0%2Bgit34-g55a4e7e-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,504 kB
  • ctags: 2,094
  • sloc: python: 12,766; makefile: 150
file content (64 lines) | stat: -rw-r--r-- 1,751 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python

"""
A dot stimulus.

This module contains a class implementing a dot stimulus.

"""

__author__ = 'Florian Krause <florian@expyriment.org>, \
Oliver Lindemann <oliver@expyriment.org>'
__version__ = '0.7.0'
__revision__ = '55a4e7e'
__date__ = 'Wed Mar 26 14:33:37 2014 +0100'

import defaults
from _circle import Circle

class Dot(Circle):
    """A class implementing a basic 2D dot."""

    def __init__(self, radius, colour=None, position=None):
        """Create a dot.

        DEPRECATED CLASS: Please use 'Circle'!

        Parameters
        ----------
        radius : int
            radius of the dot
        colour : (int, int, int), optional
            colour of the dot
        position : (int, int), optional
            position of the stimulus

        """

        if position is None:
            position = defaults.dot_position
        if colour is None:
            colour = defaults.dot_colour
        Circle.__init__(self, diameter=radius*2, colour=colour,
                        position=position)

    def is_overlapping(self, other, minimal_gap=0):
        """DEPRECATED METHOD: Please use 'overlapping_with_circle'"""
        return self.overlapping_with_circle(other, minimal_gap)

    def is_center_inside(self, other):
        """DEPRECATED METHOD: Please use 'center_inside_circle'"""
        return self.center_inside_circle(other)

    def is_inside(self, other):
        """DEPRECATED METHOD: Please use 'inside_circle'"""
        return self.inside_circle(other)

if __name__ == "__main__":
    from expyriment import control
    control.set_develop_mode(True)
    defaults.event_logging = 0
    exp = control.initialize()
    dot = Dot(radius=100)
    dot.present()
    exp.clock.wait(1000)