setter def size ( self, value ): WindowMixin. PSYCHOPY ALIGNHORIZ UPDATEwin ) # need to update the font to reflect the change self. units in defaultLetterHeight : height = defaultLetterHeight else : msg = ( "TextStim does now know a default letter height " "for units %s " ) raise AttributeError ( msg % repr ( self. :ref:`Operations ` supported.""" # height in pix (needs to be done after units which is done during # _Base._init_) if height is None : if self. The width of the letters is then defined by the font. Height includes the entire box that surrounds the letters in the font. _listID, 1 ) except ( ImportError, ModuleNotFoundError, TypeError ): pass # if pyglet no longer exists def height ( self, height ): """The height of the letters (Float/int or None = set default). name, str ( self ))) def _del_ ( self ): if GL : # because of pytest fail otherwise try : GL. autoDraw = autoDraw # set autoLog now that params have been initialised wantLog = autoLog is None and self. contrast = contrast # self.width and self._fontHeightPix get set with text and # calcSizeRendered is called self. setHeight ( height, log = False ) # calls setFont() at some point # calls attributeSetter without log setAttribute ( self, 'wrapWidth', wrapWidth, log = False ) self. fontFiles = list ( fontFiles ) # calls attributeSetter self. Please " "use color and colorSpace args instead" ) self. warning ( "Use of rgb arguments to stimuli are deprecated. glGenLists ( 1 ) # pygame text needs a surface to render to: if not self. anchorVert = anchorVert # generate the texture and list holders self. Use alignText " "and anchorHoriz attributes instead" ) # for compatibility, alignText was historically 'left' alignText, anchorHoriz = alignHoriz, alignHoriz # alignment and anchors self. warning ( "TextStim.alignHoriz is deprecated. Use the " "anchorVert attribute instead" ) # for compatibility, alignText was historically 'left' anchorVert = alignHoriz if alignHoriz : self. warning ( "TextStim.alignVert is deprecated. pos = pos # deprecated attributes if alignVert : self. _dict_ = ArabicReshaper ( configuration = arabic_config ) self. gl import psychopy # so we can get the _path_ from psychopy import logging # tools must only be imported *after* event or MovieStim breaks on win32 # (JWP has no idea why!) from import cm2pix, deg2pix, convertToPix from import attributeSetter, setAttribute from import ( BaseVisualStim, ForeColorMixin, ContainerMixin, WindowMixin ) from lors import Color # for displaying right-to-left (possibly bidirectional) text correctly: from bidi import algorithm as bidi_algorithm # sufficient for Hebrew # extra step needed to reshape Arabic/Farsi characters depending on # their neighbours: try : from arabic_reshaper import ArabicReshaper haveArabic = True except ImportError : haveArabic = False import numpy try : import pygame havePygame = True except Exception : havePygame = False defaultLetterHeight = # shift by 1 to be compatible with the bidi algorithm self. options = False import ctypes GL = pyglet. PSYCHOPY ALIGNHORIZ DRIVERS# Shaders will work but require OpenGL2.0 drivers AND PyOpenGå…ƒ.0+ import pyglet pyglet. import os import glob import warnings # Ensure setting pyglet.options to False is done prior to any # other calls to pyglet or pyglet submodules, otherwise it may not get picked # up by the pyglet GL engine and have no effect. PSYCHOPY ALIGNHORIZ LICENSE# Distributed under the terms of the GNU General Public License (GPL). #!/usr/bin/env python # -*- coding: utf-8 -*- '''Class of text stimuli to be displayed in a :class:`~` ''' # Part of the PsychoPy library # Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2022 Open Science Tools Ltd.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |