コード例 #1
0
    def setMouseType(self, name='arrow'):
        """Change the appearance of the cursor for this window. Cursor types
        provide contextual hints about how to interact with on-screen objects.

        The graphics used 'standard cursors' provided by the operating system.
        They may vary in appearance and hot spot location across platforms. The
        following names are valid on most platforms:

                'arrow' : Default pointer
                'ibeam' : Indicates text can be edited
            'crosshair' : Crosshair with hot-spot at center
                 'hand' : A pointing hand
              'hresize' : Double arrows pointing horizontally
              'vresize' : Double arrows pointing vertically

        Note, on Windows the 'crosshair' option is XORed with the background
        color. It will not be visible when placed over 50% grey fields.

        :param name: str, type of standard cursor to use
        :return:

        """
        try:
            glfw.set_cursor(self.winHandle, _CURSORS_[name])
        except KeyError:
            logging.warn(
                "Invalid cursor type name '{}', using default.".format(type))
            glfw.set_cursor(self.winHandle, _CURSORS_['arrow'])
コード例 #2
0
ファイル: glfwbackend.py プロジェクト: hsogo/psychopy
    def setMouseType(self, name='arrow'):
        """Change the appearance of the cursor for this window. Cursor types
        provide contextual hints about how to interact with on-screen objects.

        The graphics used 'standard cursors' provided by the operating system.
        They may vary in appearance and hot spot location across platforms. The
        following names are valid on most platforms:

        * ``arrow`` : Default pointer
        * ``ibeam`` : Indicates text can be edited
        * ``crosshair`` : Crosshair with hot-spot at center
        * ``hand`` : A pointing hand
        * ``hresize`` : Double arrows pointing horizontally
        * ``vresize`` : Double arrows pointing vertically

        Requires the GLFW backend, otherwise this function does nothing! Note,
        on Windows the ``crosshair`` option is negated with the background
        color. It will not be visible when placed over 50% grey fields.

        Parameters
        ----------
        name : str
            Type of standard cursor to use.

        """
        try:
            glfw.set_cursor(self.winHandle, _CURSORS_[name])
        except KeyError:
            logging.warn(
                "Invalid cursor type name '{}', using default.".format(type))
            glfw.set_cursor(self.winHandle, _CURSORS_['arrow'])
コード例 #3
0
    def setMouseType(self, name='arrow'):
        """Change the appearance of the cursor for this window. Cursor types
        provide contextual hints about how to interact with on-screen objects.

        The graphics used 'standard cursors' provided by the operating system.
        They may vary in appearance and hot spot location across platforms. The
        following names are valid on most platforms:

        * ``arrow`` : Default pointer
        * ``ibeam`` : Indicates text can be edited
        * ``crosshair`` : Crosshair with hot-spot at center
        * ``hand`` : A pointing hand
        * ``hresize`` : Double arrows pointing horizontally
        * ``vresize`` : Double arrows pointing vertically

        Requires the GLFW backend, otherwise this function does nothing! Note,
        on Windows the ``crosshair`` option is negated with the background
        color. It will not be visible when placed over 50% grey fields.

        Parameters
        ----------
        name : str
            Type of standard cursor to use.

        """
        try:
            glfw.set_cursor(self.winHandle, _CURSORS_[name])
        except KeyError:
            logging.warn(
                "Invalid cursor type name '{}', using default.".format(type))
            glfw.set_cursor(self.winHandle, _CURSORS_['arrow'])
コード例 #4
0
ファイル: glfwbackend.py プロジェクト: hoechenberger/psychopy
    def setMouseType(self, name='arrow'):
        """Change the appearance of the cursor for this window. Cursor types
        provide contextual hints about how to interact with on-screen objects.

        The graphics used 'standard cursors' provided by the operating system.
        They may vary in appearance and hot spot location across platforms. The
        following names are valid on most platforms:

                'arrow' : Default pointer
                'ibeam' : Indicates text can be edited
            'crosshair' : Crosshair with hot-spot at center
                 'hand' : A pointing hand
              'hresize' : Double arrows pointing horizontally
              'vresize' : Double arrows pointing vertically

        Note, on Windows the 'crosshair' option is XORed with the background
        color. It will not be visible when placed over 50% grey fields.

        :param name: str, type of standard cursor to use
        :return:

        """
        try:
            glfw.set_cursor(self.winHandle, _CURSORS_[name])
        except KeyError:
            logging.warn(
                "Invalid cursor type name '{}', using default.".format(type))
            glfw.set_cursor(self.winHandle, _CURSORS_['arrow'])
コード例 #5
0
    def __init__(self):
        super().__init__(500, 500, 'my window 1', monitor=None, shared=None)
        self.framerate = 60
        # enable camera move
        self.cameras[0].tripod.lookat((100, 100, 100), (0, 0, 0), (0, 0, 1))
        self.cameras.attach_fps_dolly(0)

        # create model
        self.model = AModel()
        e = 100
        self.model.append_shape(Tgl([0, 0, 0], [e, 0, 0], [0, e, 0]))
        self.model.append_shape(Tgl([0, 0, 0], [0, e, 0], [0, 0, e]))
        self.model.append_shape(Tgl([0, 0, 0], [e, 0, 0], [0, 0, e]))
        glfw.set_cursor(self.glfw_window,
                        glfw.create_standard_cursor(glfw.CROSSHAIR_CURSOR))
コード例 #6
0
ファイル: glfwbackend.py プロジェクト: RebeccaHirst/psychopy
    def setMouseCursor(self, cursorType='arrow'):
        """Change the appearance of the cursor for this window. Cursor types
        provide contextual hints about how to interact with on-screen objects.

        The graphics used 'standard cursors' provided by the operating system.
        They may vary in appearance and hot spot location across platforms. The
        following names are valid on most platforms:

        * ``arrow`` or ``default`` : Default system pointer.
        * ``ibeam`` or ``text`` : Indicates text can be edited.
        * ``crosshair`` : Crosshair with hot-spot at center.
        * ``hand`` : A pointing hand.
        * ``hresize`` : Double arrows pointing horizontally.
        * ``vresize`` : Double arrows pointing vertically.

        Parameters
        ----------
        cursorType : str
            Type of standard cursor to use.

        """
        try:
            cursor = _GLFW_CURSORS_[cursorType]  # get cursor

            if cursor is None:  # check supported by backend
                logging.warn(
                    "Cursor type name '{}', is not supported by this backend. "
                    "Setting cursor to system default.".format(cursorType))

                cursor = _GLFW_CURSORS_['default']  # all backends define this

        except KeyError:
            logging.warn(
                "Invalid cursor type name '{}', using system default.".format(
                    cursorType))

            cursor = _GLFW_CURSORS_['default']

        glfw.set_cursor(self.winHandle, cursor)