TextBox ================================ .. code-block:: python class psychopy.visual.TextBox(window=None, text='Default Test Text.', font_name=None, bold=False, italic=False, font_size=32, font_color=(0, 0, 0, 1), dpi=72, line_spacing=0, line_spacing_units='pix', background_color=None, border_color=None, border_stroke_width=1, size=None, textgrid_shape=None, pos=(0.0, 0.0), align_horz='center', align_vert='center', units='norm', grid_color=None, grid_stroke_width=1, color_space='rgb', opacity=1.0, grid_horz_justification='left', grid_vert_justification='top', autoLog=True, interpolate=False, name=None) TextStimã¨åŒæ§˜ã«ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã«æ–‡å—ã‚’æç”»ã™ã‚‹ãŸã‚ã«ä½¿ç”¨ã™ã‚‹ã€‚TextStimã¨TextBoxã«ã¯ãれãžã‚Œé•·æ‰€ã¨çŸæ‰€ãŒã‚りã€å®Ÿé¨“ã§ã®ç”¨é€”ã«å¿œã˜ã¦ä½¿ã„分ã‘ã‚‹å¿…è¦ãŒã‚る。 注:ãƒãƒ¼ã‚¸ãƒ§ãƒ³1.79ã§æ£å¼ã«è¿½åŠ ã•れãŸãŒã€ã¾ã 開発段階ã ã¨è€ƒãˆã¦ãŠã„ã¦ã»ã—ã„。二ã¤ã®TextBoxã®ãƒ‡ãƒ¢ã¯PsychoPyãŒã‚µãƒãƒ¼ãƒˆã™ã‚‹ã™ã¹ã¦ã®OS上ã§å‹•作ã™ã‚‹ã“ã¨ãŒç¢ºèªã•れã¦ã„ã‚‹ãŒã€TextBoxã®ã‚³ãƒ¼ãƒ‰ã«ã¯ã¾ã ãƒã‚°ãŒå«ã¾ã‚Œã¦ã„ã‚‹å¯èƒ½æ€§ã¯é«˜ã„。ã¾ãŸã€TextBoxã®APIã¯ä»Šå¾Œæ•°ã‹æœˆã®ã†ã¡ã«ã•らã«å¼·åŒ–ã•ã‚Œã€æ”¹å–„ã•れã¦ã„ãå¯èƒ½æ€§ãŒé«˜ã„。(訳注:ã“ã®ã€Œæ•°ã‹æœˆã€ã¨ã„ã†ã®ã¯PsychoPy 1.79ãŒãƒªãƒªãƒ¼ã‚¹ã•ã‚ŒãŸæ™‚点ã®è©±ã¨æ€ã‚れる) .. NOTE: As of PsychoPy 1.79, TextBox should be considered experimental. The two TextBox demo scripts provided have been tested on all PsychoPy supported OS's and run without exceptions. However there are very likely bugs in the existing TextBox code and the TextBox API will be further enhanced and improved (i.e. changed) over the next couple months. - TextBoxã§ã¯å„æ–‡å—ã®é…ç½®æ–¹æ³•ãŒæ˜Žç¢ºã«å®šç¾©ã•れã¦ãŠã‚Šã€å„æ–‡å—ã®æ£ç¢ºãªä½ç½®ã‚’把æ¡ã™ã‚‹å¿…è¦ãŒã‚る実験ã§ä¾¿åˆ©ã§ã‚る。 - 表示ã™ã‚‹ãƒ†ã‚ストã®å¤‰æ›´ã¨è¡¨ç¤ºã¯(TextStimã¨æ¯”ã¹ã¦)éžå¸¸ã«é«˜é€Ÿã«è¡Œã‚れる。 - 組ã¿è¾¼ã¿ã®ãƒ•ォントマãƒãƒ¼ã‚¸ãƒ£ãƒ¼ï¼šä½¿ç”¨ã—ã¦ã„ã‚‹PCã§åˆ©ç”¨ã§ãるフォントã®ãƒ•ァミリーã¨ã‚¹ã‚¿ã‚¤ãƒ«ã¸ã®ç°¡å˜ãªã‚¢ã‚¯ã‚»ã‚¹ã‚’æä¾›ã™ã‚‹ã€‚ .. Text character placement is very well defined, useful when the exact positioning of each letter needs to be known. .. The text string that is displayed can be changed ( setText() ) and drawn ( win.draw() ) very quickly. See the TextBox vs. TextStim comparison table for details. .. Built-in font manager; providing easy access to the font family names and styles that are available on the computer being used. TextBoxã¯ä»¥ä¸‹ã®ã‚°ãƒ©ãƒ•ィックè¦ç´ ã‚’å«ã‚€è¤‡åˆçš„ãªåˆºæ¿€ã§ã‚る。 - TextBox Border / Outline - TextBox Fill Area - Text Grid Cell Lines - Text Glyphs TextBoxã®ãれãžã‚Œã®ã‚°ãƒ©ãƒ•ィックè¦ç´ ã®å±žæ€§ã‚’変更ã—ã¦TextBoxã®è¦‹ãŸç›®ã®æ§˜ã€…ãªå´é¢ã‚’制御ã™ã‚‹ã“ã¨ãŒã§ãる。 .. Attributes for each of the TextBox graphical elements can be changed to control many aspects of how the TextBox is displayed. 色空間ã«'rgb'ãŠã‚ˆã³'rgb255'を使用ã—ã¦ã„ã‚‹ã¨ãã«ã¯ã€è‰²ã¯è¦ç´ æ•°3ã®ã‚·ãƒ¼ã‚±ãƒ³ã‚¹(赤ã€ç·‘ã€é’)ã¾ãŸã¯è¦ç´ æ•°4ã®ã‚·ãƒ¼ã‚±ãƒ³ã‚¹(赤ã€ç·‘ã€é’ã€ã‚¢ãƒ«ãƒ•ã‚¡)を指定ã§ãる。ã“れã«ã‚ˆã£ã¦ã€TextBoxã®å€‹ã€…ã®è¦ç´ ã«åˆ¥ã€…ã®è‰²ã¨é€æ˜Žåº¦ã‚’è¨å®šã§ãる。アルファãƒãƒ£ãƒãƒ«ã‚’å«ã‚€è‰²ã‚’指定ã—ãŸå ´åˆã¯ã€TextBox全体ã«é©ç”¨ã•れãŸopacityより優先ã•れる。アルファãƒãƒ£ãƒãƒ«ã‚’å«ã¾ãªã„色を指定ã•れãŸè¦ç´ ã¯é€šå¸¸é€šã‚Šopacityã®è¨å®šã«å¾“ã†ã€‚ .. When using 'rgb' or 'rgb255' color spaces, colors can be specified as a list/tuple of 3 elements (red, green, blue), or with four elements (reg, green, blue, alpha) which allows different elements of the TextBox to use different opacity settings if desired. For colors that include the alpha channel value, it will be applied instead of the opacity setting of the TextBox, effectively overriding the stimulus defined opacity for that part of the textbox graphics. Colors that do not include an alpha channel use the opacity setting as normal. テã‚ストã®è¡Œé–“ã‚’è¨å®šã™ã‚‹ã“ã¨ãŒã§ãる。ç‰å¹…ã®ãƒ•ォントã®ã¿ãŒã‚µãƒãƒ¼ãƒˆã•れる。 .. Text Line Spacing can be controlled. .. Only Monospace Fonts are supported. TextBoxã¯æ¨™æº–çš„ãªPsychoPyã®è¦–覚刺激ã¨ä»¥ä¸‹ã®ç‚¹ã§æ ¹æœ¬çš„ã«ç•°ãªã‚‹ã€‚ .. TextBox component is not a completely standard psychopy visual stim and has the following functional difference: - TextBoxã®å±žæ€§ã«ç›´æŽ¥çš„ã«ã‚¢ã‚¯ã‚»ã‚¹ã™ã‚‹ã“ã¨ã¯ã§ããªã„。get\*, set\*メソッドを常ã«ä½¿ç”¨ã™ã‚‹å¿…è¦ãŒã‚ã‚‹(ã“ã®åˆ¶é™ã¯å°†æ¥çš„ã«è§£æ¶ˆã•れる予定ã§ã‚ã‚‹)。 - TextBoxã®å±žæ€§ã¯ç½®ãæ›ãˆã‚‹ã®ã¿ã§ã‚ã‚Šã€æ¼”ç®—åã‚’é©ç”¨ã™ã‚‹ã“ã¨ã¯ã§ããªã„。 - ä»–ã®PsychoPyã®åˆºæ¿€ã§ã‚µãƒãƒ¼ãƒˆã•れるã‚ーワード引数ã¯ã€(TextStimã§ã‚µãƒãƒ¼ãƒˆã•れるもã®ã‚‚å«ã‚ã¦)TextBoxã§ã¯ã‚µãƒãƒ¼ãƒˆã•れãªã„。TextBoxクラスã®å®šç¾©ã«ãŠã‘る引数をå‚ç…§ã®ã“ã¨ã€‚ .. TextBox attributes are never accessed directly; get* and set* methods are always used (this will be changed to use class properies in the future). .. Setting an attribute of a TextBox only supports value replacement, ( textbox.setFontColor([1.0,1.0,1.0]) ) and does not support specifying operators. .. Some key word arguments supported by other stimulus types in general, or by TextStim itself, are not supported by TextBox. See the TextBox class definition for the arguments that are supported. æ–°ã—ã„フォントスタイルãŠã‚ˆã³ã‚µã‚¤ã‚ºã‚’使用ã™ã‚‹ã¨ãã«ã¯ãƒ•ォントã®èªã¿è¾¼ã¿ã«1ç§’ç¨‹åº¦ã®æ™‚é–“ã‚’è¦ã™ã‚‹ã€‚ã“ã®é…å»¶ã¯ãƒ•ォントåã€ã‚¹ã‚¿ã‚¤ãƒ«ãŠã‚ˆã³ã‚µã‚¤ã‚ºã®çµ„ã¿åˆã‚ã›ã«ã¤ã一回ãりã§ã€ä¸€åº¦èªã¿è¾¼ã¾ã‚ŒãŸå¾Œã¯ã€åŒã˜ãƒ•ォントスタイルãŒè¤‡æ•°ã®TextBoxã§ç¹°ã‚Šè¿”ã—使用ã•れã¦ã‚‚é…å»¶ã¯ã»ã¨ã‚“ã©ç”Ÿã˜ãªã„。 .. When a new font, style, and size are used it takes about 1 second to load and process the font. This is a one time delay for a given font name, style, and size. After first being loaded, the same font style can be used or re-applied to multiple TextBox components with no significant delay. autoLogãŠã‚ˆã³autoDrawã¯ç¾åœ¨ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ãªã„。 .. Auto logging or auto drawing is not currently supported. ================================== ========== ============== é …ç›® TextBox TextStim ================================== ========== ============== テã‚ストã®å¤‰æ›´ã¨å†æç”» 1.513 msec 28.537 msec テã‚スト変更ã›ãšå†æç”» 0.240 msec 0.931 msec オブジェクトã®ç”Ÿæˆ 0.927 msec 0.194 msec ç‰å¹…フォントã®ã‚µãƒãƒ¼ãƒˆ Yes Yes プãƒãƒãƒ¼ã‚·ãƒ§ãƒŠãƒ«ãƒ•ォントã®ã‚µãƒãƒ¼ãƒˆ No Yes 改行幅ã®èª¿æ•´ Yes No æ£ç¢ºãªæ–‡å—ä½ç½®ã®æƒ…å ± Yes No 回転ã®ã‚µãƒãƒ¼ãƒˆ No Yes 折り返ã—ã®ã‚µãƒãƒ¼ãƒˆ Yes Yes ================================== ========== ============== .. Feature TextBox TextStim .. Change text + redraw time^ 1.513 msec 28.537 msec .. No change + redraw time^ 0.240 msec 0.931 msec .. Initial Creation time^ 0.927 msec 0.194 msec .. MonoSpace Font Support Yes Yes .. Non MonoSpace Font Support No Yes .. Adjustable Line Spacing Yes No .. Precise Text Pos. Info Yes No .. Auto logging Support No Yes .. Rotation Support No Yes .. Word Wrapping Support Yes Yes .. ^ Times are in msec.usec format. Tested using the textstim_vs_textbox.py デモスクリプトãŒPsychoPyã¨ä¸€ç·’ã«é…布ã•れã¦ã„ã‚‹ã€‚çµæžœã¯ãƒ†ã‚ストã®é•·ã•ã€ãƒ“デオカードã€OSã«ä¾å˜ã™ã‚‹ã€‚上記ã®çµæžœã¯å¹³å‡24語ã€120æ–‡å—ã®æ–‡å—列ã®çµæžœã§ã‚る。使用ã—ãŸPCã¯Windows 7 64bitã€PsychoPy 1.79ã€Core i7 3.4GHz CPUã€nVidia 480GTX 2GBグラフィックカードã§ã‚る。 (訳注:コードã¯çœç•¥) .. demo script provided with the PsychoPy distribution. Results are dependent on text length, video card, and OS. Displayed results are based on 120 character string with an average of 24 words. Test computer used Windows 7 64 bit, PsychoPy 1.79, with a i7 3.4 Ghz CPU, 8 GB RAM, and NVIDIA 480 GTX 2GB graphics card. .. from psychopy import visual .. win=visual.Window((....) .. # A Textbox stim that will look similar to a TextStim component # .. textstimlike=visual.TextBox( .. window=win, text="This textbox looks most like a textstim.", .. font_size=18, font_color=[-1,-1,1], color_space='rgb', .. size=(1.8,.1), pos=(0.0,.5), units='norm') .. # A Textbox stim that uses more of the supported graphical features # .. textboxloaded=visual.TextBox( .. window=win text='TextBox showing all supported graphical elements', .. font_size=32, font_color=[1,1,1], .. border_color=[-1,-1,1], # draw a blue border around stim .. border_stroke_width=4, # border width of 4 pix. .. background_color=[-1,-1,-1], # fill the stim background .. grid_color=[1,-1,-1,0.5], # draw a red line around each .. # possible letter area, # 50% transparent .. grid_stroke_width=1, # with a width of 1 pix .. textgrid_shape=[20,2], # specify area of text box .. # by the number of cols x .. # number of rows of text to support .. # instead of by a screen # units width x height. .. pos=(0.0,-.5), # If the text string length < num rows * num cols in # textgrid_shape, how should text be justified? # grid_horz_justification='center', grid_vert_justification='center', ) .. textstimlike.draw() textboxloaded.draw() win.flip() draw() --------------------------------------- TextBoxをグラフィックカードã®ãƒãƒƒã‚¯ãƒãƒƒãƒ•ã‚¡ã«æ›¸ã込む。書ãè¾¼ã¿å¾Œã«flip()を行ã†ã“ã¨ã«ã‚ˆã£ã¦ç”»é¢ä¸Šã«è¡¨ç¤ºã•れる。flip()よりå‰ã«draw()ãŒå‘¼ã³å‡ºã•れãªã‘れã°ç”»é¢ä¸Šã«ã¯è¡¨ç¤ºã•れãªã„。 .. Draws the TextBox to the back buffer of the graphics card. Then call win.flip() to display the changes drawn. If draw() is not called prior to a call to win.flip(), the textBox will not be displayed for that retrace. getAutoLog() -------------------------------------- autoLogã®è¨å®šã‚’è¿”ã™ã€‚ç¾åœ¨ã®TextBoxã§ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ãªã„。 .. Indicates if changes to textBox attribute values should be logged automatically by PsychoPy. *Currently not supported by TextBox. getBackgroundColor() ----------------------- TextBoxã®èƒŒæ™¯éƒ¨åˆ†ã®é•·æ–¹å½¢ã‚’塗りã¤ã¶ã™è‰²ã‚’è¿”ã™ã€‚TextBoxã®ä»–ã®è¦ç´ ã¯ã™ã¹ã¦ã“ã®é•·æ–¹å½¢ã®ä¸Šã«æã‹ã‚Œã‚‹ã€‚ .. Get the color used to fill the rectangular area of the TextBox stim. All other graphical elements of the TextBox are drawn on top of the background. getBorderColor() ----------------------- TextBoxã§ã¯å‘¨å›²ã«æž ã‚’æãã“ã¨ãŒã§ãる。ã“ã®ãƒ¡ã‚½ãƒƒãƒ‰ã¯æž ã®è‰²ã‚’è¿”ã™ã€‚ .. A border can be drawn around the perimeter of the TextBox. This method sets the color of that border. getBorderWidth() ------------------------- TextBoxã®æž ç·šã®å¹…ã‚’è¿”ã™ã€‚å˜ä½ã¯å¸¸ã«pixã§ã‚る。 .. Get the stroke width of the optional TextBox area outline. This is always given in pixel units. getColorSpace() -------------------------- TextBoxã«è¨å®šã•れãŸè‰²ç©ºé–“ã‚’è¿”ã™ã€‚以下ã®å€¤ãŒã‚µãƒãƒ¼ãƒˆã•れã¦ã„る。 - 'rgb' - 'rbg255' - 'norm' - hex (implicit) - html name (implicit) (訳注:normã¯é–“é•ã„ã¨æ€ã‚れる。ã¾ãŸã€dklãªã©ã®PsychoPyãŒã•ã½ãƒ¼ã¨ã™ã‚‹rgb, rgb255以外ã®è‰²ç©ºé–“もサãƒãƒ¼ãƒˆã—ã¦ã„ã‚‹) .. Returns the psychopy color space used when specifying colors for the TextBox. Supported values are: .. 'rgb' .. 'rbg255' .. 'norm' .. hex (implicit) .. html name (implicit) .. See the Color Space section of the PsychoPy docs for details. getDisplayedText() ------------------------- TextBox内ã®ãƒ†ã‚ストを返ã™ã€‚ã™ãªã‚ã¡ã€å®Ÿéš›ã«ç”»é¢ä¸Šã«æç”»ã•れã¦ã„るテã‚ストを返ã™ã€‚ã“れã¯ä»¥ä¸‹ã®å‡¦ç†ã¨åŒæ§˜ã§ã‚る。 .. Return the text that fits within the TextBox and therefore is actually seen. This is equal to: .. code-block:: python text_length=len(self.getText()) cols,rows=self.getTextGridShape() displayed_text=self.getText()[0:min(text_length,rows*cols)] (訳注:コードãŒä¸€éƒ¨é–“é•ã£ã¦ã„ã‚‹ã¨æ€ã‚れるã®ã§ä¿®æ£ã—ãŸã€‚) getFontColor() ------------------------------- テã‚ストã®ã‚°ãƒªãƒ•ã‚’æç”»ã™ã‚‹æ™‚ã«ç”¨ã„る色を返ã™ã€‚ .. Return the color used when drawing text glyphs. getGlyphPositionForTextIndex(char_index) ----------------------------------------------- char_indexã«ç¾åœ¨è¡¨ç¤ºã•れã¦ã„るテã‚スト( getDisplayedText() )ã®ã„ãšã‚Œã‹1æ–‡å—ã®ã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹ã‚’指定ã™ã‚‹ã¨ã€æŒ‡å®šã•ã‚ŒãŸæ–‡å—ã®ãƒã‚¦ãƒ³ãƒ‡ã‚£ãƒ³ã‚°ãƒœãƒƒã‚¯ã‚¹(æ–‡å—ã‚’ã´ã£ãŸã‚Šå›²ã‚€é•·æ–¹å½¢)ã®ç”»é¢ä¸Šã§ã®ä½ç½®ã€å¹…ã€é«˜ã•ã‚’è¿”ã™ã€‚ ã“ã®ãƒ¡ã‚½ãƒƒãƒ‰ã¯ãƒ†ã‚ストグリッドã®ã‚»ãƒ«å†…ã«ãŠã‘るグリフã®ä½ç½®ã‚’考慮ã™ã‚‹ã®ã§ã€æˆ»ã‚Šå€¤ã¯ãƒ†ã‚ストグリッドã®ã‚»ãƒ«ã®ä½ç½®ã§ã¯ãªãæ£ç¢ºã«ã‚°ãƒªãƒ•ã®ä½ç½®ã§ã‚る。 テã‚ストグリッドã®ã‚»ãƒ«ã®ä½ç½®æƒ…å ±ã«ã¤ã„ã¦ã¯getTextGridCellPlacement()メソッドå‚ç…§ã®ã“ã¨ã€‚ .. For the provided char_index, which is the index of one chatacter in the current text being displayed by the TextBox ( getDisplayedText() ), return the bounding box position, width, and height for the associated glyph drawn to the screen. This factors in the glyphs position within the textgrid cell it is being drawn in, so the returned bounding box is for the actual glyph itself, not the textgrid cell. For textgrid cell placement information, see the getTextGridCellPlacement() method. グリフã®ä½ç½®ã¯(x, y, width, height)ã¨ã„ã†ã‚¿ãƒ—ルã§è¿”ã•れる。xã¨yã¯ãƒã‚¦ãƒ³ãƒ‡ã‚£ãƒ³ã‚°ãƒœãƒƒã‚¯ã‚¹ã®å·¦ä¸Šã®åº§æ¨™ã§ã‚る。 補足: - char_indexãŒç¾åœ¨è¡¨ç¤ºã•れã¦ã„るテã‚ストã®ç¯„囲を超ãˆã¦ã„ã‚‹(20æ–‡å—ã—ã‹è¡¨ç¤ºã•れã¦ã„ãªã„ã®ã«30ç•ªç›®ã®æ–‡å—を指定ã—ãŸå ´åˆãªã©)ã¨ãã¯NoneãŒè¿”ã•れる。 - u' ' (スペース) æ–‡å—ã®å ´åˆã¯ã€ãƒ†ã‚ストグリッドã®ã‚»ãƒ«å…¨ä½“ãŒè¿”ã•れる。 - u' ' (改行) æ–‡å—ã®å ´åˆã¯ãƒã‚¦ãƒ³ãƒ‡ã‚£ãƒ³ã‚°ãƒœãƒƒã‚¯ã‚¹ã¯è¿”ã•れるãŒã€ãƒœãƒƒã‚¯ã‚¹ã®å¹…ã¯0ã¨ãªã‚‹ã€‚ .. The glyph position for the given text index is returned as a tuple (x,y,width,height), where x,y is the top left hand corner of the bounding box. .. Special Cases: .. If the index provided is out of bounds for the currently displayed text, None is returned. .. For u' ' (space) characters, the full textgrid cell bounding box is returned. .. For u' ' ( new line ) characters,the textgrid cell bounding box is returned, but with the box width set to 0. getHorzAlign() ----------------------- TextBoxã®åº§æ¨™å€¤ãŒTextBoxã®ã©ã®ä½ç½®ã‚’指ã™ã‹ã‚’è¿”ã™ã€‚'left', 'center', 'right'ã®ã„ãšã‚Œã‹ã§ã‚る。 .. Return what textbox x position should be interpreted as. Valid options are 'left', 'center', or 'right' . getHorzJust() ---------------------------- ä¸€è¡Œã®æ–‡å—æ•°ãŒTextBoxã®åˆ—数より少ãªã„ã¨ãã«ã€ãã®è¡Œã®æ–‡å—ã‚’ã©ã®ã‚ˆã†ã«é…ç½®ã™ã‚‹ã‚ˆã†ã«è¨å®šã—ã¦ã„ã‚‹ã‹ã‚’è¿”ã™ã€‚ .. Return how text should laid out horizontally when the number of columns of each text grid row is greater than the number needed to display the text for that text row. getInterpolated() ---------------------------- TextBoxã®æç”»æ™‚ã«è£œé–“ãŒæœ‰åйã«ã•れã¦ã„ã‚‹ã‹ã‚’è¿”ã™ã€‚Trueã§ã‚れã°GL_LINE_SMOOTHã¨GL_POLYGON_SMOOTHãŒæœ‰åйã§ã‚る。 .. Returns whether interpolation is enabled for the TextBox when it is drawn. When True, GL_LINE_SMOOTH and GL_POLYGON_SMOOTH are enabled within OpenGL; otherwise they are disabled. getLabel() ----------------------- TextBoxã«å‰²ã‚Šå½“ã¦ã‚‰ã‚ŒãŸãƒ©ãƒ™ãƒ«ã‚’è¿”ã™ã€‚ã“れã¯åˆºæ¿€ã®æç”»ã«ã¯å½±éŸ¿ã›ãšã€å†…部処ç†ã«ã®ã¿åˆ©ç”¨ã•れる。 .. Return the label / name assigned to the textbox. This does not impact how the stimulus looks when drawn, and instead is used for internal purposes only. getLineSpacing() ------------------------- テã‚ストã®å„行ã®é–“ã«è¿½åŠ ã•れるスペースを返ã™ã€‚å˜ä½ã¯getUnits()メソッドã§è¿”ã•れるå˜ä½ã«å¾“ã†ã€‚ (訳注:getUnitType()ã®é–“é•ã„?) .. Return the additional spacing being applied between rows of text. The value is in units specified by the textbox getUnits() method. getName() --------------------- getLabelメソッドã¨åŒã˜ã§ã‚る。 .. Same as the GetLabel method. getOpacity() ----------------------- TextBoxオブジェクトã«ç¾åœ¨è¨å®šã•れã¦ã„る標準ã®ä¸é€æ˜Žåº¦ã‚’è¿”ã™ã€‚0.0ãŒå®Œå…¨ãªé€æ˜Žã§ã€1.0ãŒå®Œå…¨ã«ä¸é€æ˜Žã§ã‚る。 .. Get the default TextBox transparency level used for color related attributes. 0.0 equals fully transparent, 1.0 equals fully opaque. getPosition() ----------------------- TextBoxã®ä½ç½®(x, y)ã‚’è¿”ã™ã€‚å˜ä½ã¯getUnitType()ã§è¿”ã•れるå˜ä½ã«å¾“ã†ã€‚ .. Return the x,y position of the textbox, in getUnitType() coord space. getSize() ------------------------ TextBoxã®å¹…ã¨é«˜ã•ã‚’è¿”ã™ã€‚å˜ä½ã¯TextBoxã«è¨å®šã•れã¦ã„ã‚‹å˜ä½ã«å¾“ã†ã€‚ .. Return the width,height of the TextBox, using the unit type being used by the stimulus. getText() ---------------------- 表示ã™ã‚‹ãƒ†ã‚ストを返ã™ã€‚ .. Return the text to display. getTextGridCellForCharIndex(char_index) ------------------------------------------------- (解説ãªã—) getTextGridCellPlacement() ---------------------------------------------- TextBoxã®ãƒ†ã‚ã‚¹ãƒˆã‚°ãƒªãƒƒãƒ‰ã®æƒ…å ±ã‚’è¡¨ã™3次元ã®numpyã®è¡Œåˆ—(array)ã‚’è¿”ã™ã€‚ã“ã®è¡Œåˆ—ã®shape属性ã¯(num_cols,num_rows,cell_bounds)ã§ã€num_colsã¯TextBoxã®ãƒ†ã‚ストグリッドã®åˆ—æ•°ã€num_rowsã¯è¡Œæ•°ã§ã‚る。cell_boundsã¯ã‚»ãƒ«ã®(x座標, y座標, å¹…, 高ã•)ã®å½¢å¼ã§å„ã‚»ãƒ«ã®æƒ…å ±ã‚’ã¾ã¨ã‚ãŸè¡Œåˆ—ã§ã‚る。座標ã¯å„セルã®å·¦ä¸Šã‚’表ã™ã€‚行ã¨åˆ—ã®ã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹ã¯0ã‹ã‚‰å§‹ã¾ã‚‹ã€‚ .. Returns a 3d numpy array containing position information for each text grid cell in the TextBox. The array has the shape (num_cols,num_rows,cell_bounds), where num_cols is the number of textgrid columns in the TextBox. num_rows is the number of textgrid rows in the TextBox. cell_bounds is a 4 element array containing the (x pos, y pos, width, height) data for the given cell. Position fields are for the top left hand corner of the cell box. Column and Row indices start at 0. テã‚ストグリッドã®è¡Œæ•°ãŠã‚ˆã³åˆ—æ•°ã‚’å¾—ã‚‹ã«ã¯ä»¥ä¸‹ã®ã‚ˆã†ã«ã™ã‚‹ã€‚ .. To get the shape of the textgrid in terms of columns and rows, use: .. code-block:: python cell_pos_array=textbox.getTextGridCellPlacement() col_row_count=cell_pos_array.shape[:2] 0行0列目(ã™ãªã‚ã¡å·¦ä¸Šã®ã‚»ãƒ«)ã®ã‚»ãƒ«ã®åº§æ¨™ã€å¹…ã€é«˜ã•ã«ã‚¢ã‚¯ã‚»ã‚¹ã™ã‚‹ã«ã¯ä»¥ä¸‹ã®ã‚ˆã†ã«ã™ã‚‹ã€‚ .. To access the position, width, and height for textgrid cell at column 0 and row 0 (so the top left cell in the textgrid): .. code-block:: python cell00=cell_pos_array[0,0,:] 1行目ã€3列目ã®ã‚»ãƒ«(インデックスã¯0ã‹ã‚‰å§‹ã¾ã‚‹ã®ã§æœ€åˆã®è¡Œã‚’1行目ã¨ã™ã‚‹æ•°ãˆæ–¹ã§2番目ã®è¡Œã®4番目ã®åˆ—ã«ç›¸å½“)ã«ã‚¢ã‚¯ã‚»ã‚¹ã™ã‚‹ã«ã¯ä»¥ä¸‹ã®ã‚ˆã†ã«ã™ã‚‹ã€‚ .. For the cell at col 3, row 1 (so 4th cell on second row): .. code-block:: python cell41=cell_pos_array[4,1,:] getTextGridLineColor() ----------------------- テã‚ã‚¹ãƒˆã‚°ãƒªãƒƒãƒ‰ã®æž ç·šã‚’æç”»ã™ã‚‹è‰²ã‚’è¿”ã™ã€‚TextBoxã®å€‹ã€…ã®æ–‡å—ã¯ãƒ†ã‚ストグリッドã®ã„ãšã‚Œã‹ã®ã‚»ãƒ«ã«å…¥ã‚‹ã€‚色ã®å€¤ã¯TextBoxã«è¨å®šã•れãŸè‰²ç©ºé–“ã§é©åˆ‡ãªã‚‚ã®ã§ãªã‘れã°ãªã‚‰ãªã„。 .. Return the color used when drawing the outline of the text grid cells. Each letter displayed in a TextBox populates one of the text cells defined by the shape of the TextBox text grid. Color value must be valid for the color space being used by the TextBox. Noneã¯ãƒ†ã‚ã‚¹ãƒˆã‚°ãƒªãƒƒãƒ‰ã®æž ç·šãŒéžå¸¸æ™‚ã§ã‚ã‚‹ã“ã¨ã‚’示ã—ã¦ã„る。 .. A value of None indicates drawing of the textgrid lines is disabled. getTextGridLineWidth() ----------------------- テã‚ストグリッドã®ã‚»ãƒ«ã®å‘¨è¾ºã«å¼•ãæž ç·šã®å¤ªã•ã‚’è¿”ã™ã€‚ .. Return the stroke width (in pixels) of the optional lines drawn around the text grid cell areas. getUnitType() ------------------- TextBoxãŒä½¿ç”¨ã—ã¦ã„ã‚‹å˜ä½ã‚’è¿”ã™ã€‚ä½ç½®ã‚„大ãã•ã¯ã“ã®å˜ä½ã‚’用ã„ã¦æŒ‡å®šã—ãªã‘れã°ãªã‚‰ãªã„。 .. Returns which of the psychopy coordinate systems are used by the TextBox. Position and size related attributes mush be specified relative to the unit type being used. Valid options are: .. pix .. norm .. cm getValidStrokeWidths() -------------------------------- グラフィックカードã§ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã‚‹ç·šå¹…ã®ç¯„囲を返ã™ã€‚TextBoxã§è£œé–“ãŒç”¨ã„られã¦ã„れã°((最å°ã®ç·šå¹…, 最大ã®ç·šå¹…), ç·šå¹…ã®ç²’度)ã‚’è¿”ã™ã€‚補間ãŒç„¡åйãªå ´åˆã¯(最å°ã®ç·šå¹…, 最大ã®ç·šå¹…)ã‚’è¿”ã™ã€‚ .. Returns the stroke width range supported by the graphics card being used. If the TextBox is Interpolated, a tuple is returns using float values, with the following structure: .. ((min_line_width, max_line_width), line_width_granularity) .. If Interpolation is disabled for the TextBox, the returned tuple elements are int values, with the following structure: .. (min_line_width, max_line_width) getVertAlign() ---------------- TextBoxã®Y座標ãŒã©ã®ä½ç½®ã‚’指ã—ã¦ã„ã‚‹ã‹ã‚’è¿”ã™ã€‚'top', 'center', 'bottom'ã®ã„ãšã‚Œã‹ã§ã‚る。 .. Return what textbox y position should be interpreted as. Valid options are 'top', 'center', or 'bottom' . .. getVertJust() テã‚ストを表示ã™ã‚‹ãŸã‚ã«å¿…è¦ãªè¡Œæ•°ãŒç¾åœ¨ã®TextBoxã®è¡Œæ•°ã‚ˆã‚Šå¤šã„時ã®å‹•作を返ã™ã€‚ .. Return how text should layed out vertically when the number of text grid rows is greater than the number needed to display the current text getWindow() ------------------- TextBoxã«å‰²ã‚Šå½“ã¦ã‚‰ã‚Œã¦ã„ã‚‹PsychoPyã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚’è¿”ã™ã€‚ .. Returns the psychopy window that the textBox is associated with. setAutoLog(v) ----------------------- autoLogã‚’è¨å®šã™ã‚‹ã€‚ç¾åœ¨ã®TextBoxã§ã¯ã‚µãƒãƒ¼ãƒˆã•れã¦ã„ãªã„。 .. Specify if changes to textBox attribute values should be logged automatically by PsychoPy. True enables auto logging; False disables it. *Currently not supported by TextBox. setBackgroundColor(c) -------------------------- TextBoxã®èƒŒæ™¯éƒ¨åˆ†ã®é•·æ–¹å½¢ã‚’塗りã¤ã¶ã™è‰²ã‚’è¨å®šã™ã‚‹ã€‚TextBoxã«è¨å®šã•れãŸè‰²ç©ºé–“ã§å¦¥å½“ãªå€¤ã§ãªã‘れã°ãªã‚‰ãªã„。Noneã‚’è¨å®šã™ã‚‹ã¨èƒŒæ™¯ã‚’塗りã¤ã¶ã•ãªã„。 .. Set the fill color used to fill the rectangular area of the TextBox stim. Color value must be valid for the color space being used by the TextBox. .. A value of None will disable drawing of the TextBox background. setBorderColor(c) --------------------- TextBoxã®æž ç·šã®è‰²ã‚’è¨å®šã™ã‚‹ã€‚TextBoxã«è¨å®šã•れãŸè‰²ç©ºé–“ã§å¦¥å½“ãªå€¤ã§ãªã‘れã°ãªã‚‰ãªã„。Noneã‚’è¨å®šã™ã‚‹ã¨æž ç·šã‚’æç”»ã—ãªã„。 .. Set the color to use for the border of the textBox. The TextBox border is a rectangular outline drawn around the edges of the TextBox stim. Color value must be valid for the color space being used by the TextBox. .. A value of None will disable drawing of the border. setBorderWidth(c) ----------------------- TextBoxã®æž ç·šã®å¹…ã‚’pixå˜ä½ã§æŒ‡å®šã™ã‚‹ã€‚値ã¯ã‚°ãƒ©ãƒ•ィックカードã®OpenGLドライãƒã«ã‚ˆã£ã¦ã‚µãƒãƒ¼ãƒˆã•れる範囲内ã§ãªã‘れã°ãªã‚‰ãªã„。範囲外ã®å€¤ã‚’指定ã—ãŸå ´åˆã¯ç¯„å›²å†…ã§æœ€ã‚‚è¿‘ã„å€¤ã§æç”»ã•ã‚Œã‚‹ã€‚ç·šã®æœ€å°ã€æœ€å¤§å¹…ã‚’å–å¾—ã™ã‚‹ã«ã¯getValidStrokeWidths()を使用ã™ã‚‹ã¨ã‚ˆã„。 .. Set the stroke width (in pixels) to use for the border of the TextBox stim. Border values must be within the range of stroke widths supported by the OpenGL driver used by the graphics. Setting the width outside the valid range will result in the stroke width being clamped to the nearest end of the valid range. .. Use the TextBox.getValidStrokeWidths() to access the minimum - maximum range of valid line widths. setFontColor(c) ----------------------- TextBox内ã®ãƒ•ォントグリフをæç”»ã™ã‚‹éš›ã«ä½¿ç”¨ã™ã‚‹è‰²ã‚’指定ã™ã‚‹ã€‚TextBoxã«è¨å®šã•れãŸè‰²ç©ºé–“ã§å¦¥å½“ãªå€¤ã§ãªã‘れã°ãªã‚‰ãªã„。'rgb'ã¨'rgb255'色空間ã®å ´åˆã¯3ã¾ãŸã¯4è¦ç´ ã®ã‚·ãƒ¼ã‚±ãƒ³ã‚¹ã‚’指定ã§ãる。3è¦ç´ ã®å ´åˆã¯ä¸é€æ˜Žåº¦ã¯getOpacity()ã§å¾—られる値ãŒç”¨ã„られる。4è¦ç´ ã®å ´åˆã¯ç¬¬4ã®å€¤ãŒã‚¢ãƒ«ãƒ•ァ値ã¨ã—ã¦ç”¨ã„られる。 .. Set the color to use when drawing text glyphs within the TextBox. Color value must be valid for the color space being used by the TextBox. For 'rgb', 'rgb255', and 'norm' based colors, three or four element lists are valid. Three element colors use the TextBox getOpacity() value to determine the alpha channel for the color. Four element colors use the value of the fourth element to set the alpha value for the color. setHorzAlign(v) ------------------------ X座標ã®å€¤ãŒTextBoxã®ã©ã®ä½ç½®ã«å¯¾å¿œã™ã‚‹ã‹ã‚’指定ã™ã‚‹ã€‚'left'ãªã‚‰ã°å·¦ç«¯ã€'right'ãªã‚‰ã°å³ç«¯ã€'center'ãªã‚‰ã°ä¸å¿ƒã§ã‚る。 .. Specify how the horizontal (x) component of the TextBox position is to be interpreted. left = x position is the left edge, right = x position is the right edge x position, and center = the x position is used to center the stim horizontally. setHorzJust(v) -------------------- TextBox内ã§ãƒ†ã‚ストãŒã©ã®ã‚ˆã†ã«æƒãˆã‚‰ã‚Œã‚‹ã‹ã‚’指定ã™ã‚‹ã€‚例ãˆã°TextBoxã®ãƒ†ã‚ストグリッドãŒ10列(=1行ãŒ10æ–‡å—)ã§ãƒ†ã‚ストãŒ6æ–‡å—ã®æ™‚ã€å·¦å¯„ã›ã§è¡¨ç¤ºã—ãŸã‘れã°'left'ã€ä¸å¤®å¯„ã›ã§è¡¨ç¤ºã—ãŸã‘れã°'center'(ã“ã®ä¾‹ã®å ´åˆã€å·¦å³ã«2æ–‡å—分ãšã¤ç©ºç™½ãŒã§ãã‚‹)ã€å³å¯„ã›ã§è¡¨ç¤ºã—ãŸã‘れã°'right'を指定ã™ã‚‹ã€‚ .. Specify how text within the TextBox should be aligned horizontally. For example, if a text grid has 10 columns, and the text being displayed is 6 characters in length, the horizontal justification determines if the text should be draw starting at the left of the text columns (left), or should be centered on the columns ('center', in this example there would be two empty text cells to the left and right of the text.), or should be drawn such that the last letter of text is drawn in the last column of the text row ('right'). setInterpolated(interpolate) ---------------------------------- TextBoxã®æç”»æ™‚ã«è£œé–“を有効ã«ã™ã‚‹ã‹ã‚’è¨å®šã™ã‚‹ã€‚Trueã«ã™ã‚Œã°GL_LINE_SMOOTHã¨GL_POLYGON_SMOOTHãŒæœ‰åйã¨ãªã‚‹ã€‚Falseã«ã™ã‚Œã°ã“れらã¯ç„¡åйã¨ãªã‚‹ã€‚ .. Specify whether interpolation should be enabled for the TextBox when it is drawn. When interpolate == True, GL_LINE_SMOOTH and GL_POLYGON_SMOOTH are enabled within OpenGL. When interpolate is set to False, GL_POLYGON_SMOOTH and GL_LINE_SMOOTH are disabled. setOpacity(o) ------------------------ TextBoxã®ä¸é€æ˜Žåº¦ã‚’è¨å®šã™ã‚‹ã€‚0.0ãªã‚‰å®Œå…¨ãªé€æ˜Žã€1.0ãªã‚‰å®Œå…¨ãªä¸é€æ˜Žã§ã‚る。Noneを指定ã—ãŸå ´åˆã¯1.0ã¨è§£é‡ˆã•れる。 色ãŒï¼”次元ã®å€¤ã§æŒ‡å®šã•れã¦ã„ã‚‹å ´åˆã¯ã“ã®è¨å®šã¯ç„¡è¦–ã•れる。 .. Sets the TextBox transparency level to use for color related attributes of the Textbox. 0.0 equals fully transparent, 1.0 equals fully opaque. .. If opacity is set to None, it is assumed to have a default value of 1.0. .. When a color is defined with a 4th element in the colors element list, then this opacity value is ignored and the alpha value provided in the color itself is used for that TextGrid element instead. setPosition(pos) ----------------------- TextBoxã®ä½ç½®(x, y)ã‚’è¨å®šã™ã‚‹ã€‚TextBoxã«è¨å®šã•れãŸå˜ä½ã«å¾“ã†ã€‚ .. Set the (x,y) position of the TextBox on the Monitor. The position must be given using the unit coord type used by the stim. TextBoxã®ä½ç½®ã¯horzAlignmentã¨vertAlignmentã®è¨å®šã«å¾“ã£ã¦æ±ºå®šã•れる。詳ã—ãã¯getHorzAlignment()ã¨getVertAlignment()ã‚’å‚ç…§ã®ã“ã¨ã€‚ .. The TextBox position is interpreted differently depending on the Horizontal and Vertical Alignment settings of the stim. See getHorzAlignment() and getVertAlignment() for more information. .. For example, if the TextBox alignment is specified as left, top, then the position specifies the top left hand corner of where the stim will be drawn. An alignment of bottom,right indicates that the position value will define where the bottom right corner of the TextBox will be drawn. A horz., vert. alignment of center, center will place the center of the TextBox at pos. setText(text_source) ------------------------ TextBoxã«è¡¨ç¤ºã™ã‚‹ãƒ†ã‚ストを指定ã™ã‚‹ã€‚ TextBoxã®è¡Œæ•°ã¨åˆ—æ•°ã¯ä½œæˆæ™‚ã«æ±ºå®šã•れã€ãã®å¾Œã¯å¤‰æ›´ã•れãªã„ç‚¹ã«æ³¨æ„。行数ã€åˆ—数を変更ã™ã‚‹ã«ã¯æ–°ãŸãªTextBoxを作æˆã—ãªã‘れã°ãªã‚‰ãªã„。ã—ãŸãŒã£ã¦ã€TextBoxを作æˆã™ã‚‹éš›ã«è¡¨ç¤ºã™ã‚‹äºˆå®šã®ãƒ†ã‚ストã®ãªã‹ã§æœ€é•·ã®ã‚‚ã®ã‚’表示ã§ãる大ãã•を確ä¿ã™ã‚‹ã‚ˆã†ã«ã™ã‚‹ã“ã¨ã€‚テã‚ストã®TextBoxã‹ã‚‰ã¯ã¿å‡ºãŸéƒ¨åˆ†ã¯è¡¨ç¤ºã•れãªã„。 .. Set the text to be displayed within the Textbox. .. Note that once a TextBox has been created, the number of character rows and columns is static. To change the size of a TextBox, a new TextBox stim must be created to replace the current Textbox stim. Therefore ensure that the textbox is large enough to display the largest length string to be presented in the TextBox. Characters that do not fit within the TextBox will not be displayed. .. Color value must be valid for the color space being used by the TextBox. setTextGridLineColor(c) ------------------------------- テã‚ストグリッドã®ç·šã‚’引ãéš›ã®è‰²ã‚’指定ã™ã‚‹ã€‚ã“れã¯ãƒ†ã‚ストグリッド内ã®å€‹ã€…ã®æ–‡å—ã®ãƒã‚¦ãƒ³ãƒ‡ã‚£ãƒ³ã‚°ãƒœãƒƒã‚¯ã‚¹ã‚’示ã™ç·šã§ã‚る。TextBoxã«è¨å®šã•れãŸè‰²ç©ºé–“ã§å¦¥å½“ãªå€¤ã§ãªã‘れã°ãªã‚‰ãªã„。Noneを指定ã™ã‚‹ã¨ç·šã‚’æç”»ã—ãªã„。 .. Set the color used when drawing text grid lines. These are lines that can be drawn which mark the bounding box for each character within the TextBox text grid. Color value must be valid for the color space being used by the TextBox. .. Provide a value of None to disable drawing of textgrid lines. setTextGridLineWidth(c) ---------------------------- テã‚ストグリッドã®ãƒã‚¦ãƒ³ãƒ‡ã‚£ãƒ³ã‚°ãƒœãƒƒã‚¯ã‚¹ã®æž ç·šã®å¹…ã‚’pixã§æŒ‡å®šã™ã‚‹ã€‚値ã¯ã‚°ãƒ©ãƒ•ィックカードã®OpenGLドライãƒã«ã‚ˆã£ã¦ã‚µãƒãƒ¼ãƒˆã•れる範囲内ã§ãªã‘れã°ãªã‚‰ãªã„。範囲外ã®å€¤ã‚’指定ã—ãŸå ´åˆã¯ç¯„å›²å†…ã§æœ€ã‚‚è¿‘ã„å€¤ã§æç”»ã•ã‚Œã‚‹ã€‚ç·šã®æœ€å°ã€æœ€å¤§å¹…ãŠã‚ˆã³ç²’度をå«ã‚€OpenGLã®ãƒ‘ラメータã®è¾žæ›¸ã‚ªãƒ–ジェクトを得るã«ã¯getGLineRanges()を用ã„る。 .. Set the stroke width (in pixels) to use for the text grid character bounding boxes. Border values must be within the range of stroke widths supported by the OpenGL driver used by the computer graphics card. Setting the width outside the valid range will result in the stroke width being clamped to the nearest end of the valid range. (訳注:getValidStrokeWidths()ã®é–“é•ã„?) .. Use the TextBox.getGLineRanges() to access a dict containing some OpenGL parameters which provide the minimum, maximum, and resolution of valid line widths. setVertAlign(v) ------------------------ Y座標ã®å€¤ãŒTextBoxã®ã©ã®ä½ç½®ã«å¯¾å¿œã™ã‚‹ã‹ã‚’指定ã™ã‚‹ã€‚'top'ãªã‚‰ã°ä¸Šç«¯ã€'bottom'ãªã‚‰ã°ä¸‹ç«¯ã€'center'ãªã‚‰ã°ä¸å¿ƒã§ã‚る。 .. Specify how the vertical (y) component of the TextBox position is to be interpreted. top = y position is the top edge, bottom = y position is the bottom edge y position, and center = the y position is used to center the stim vertically. setVertJust(v) ------------------------- TextBox内ã§ãƒ†ã‚ストãŒã©ã®ã‚ˆã†ã«æƒãˆã‚‰ã‚Œã‚‹ã‹ã‚’指定ã™ã‚‹ã€‚例ãˆã°TextBoxã®ãƒ†ã‚ストグリッドãŒ3行ã§ãƒ†ã‚ストãŒ1行ã§è¡¨ç¤ºã§ãã‚‹é•·ã•ã ã¨ã™ã‚‹ã€‚上寄ã›ã§è¡¨ç¤ºã—ãŸã‘れã°'top'ã€ä¸å¤®å¯„ã›ã§è¡¨ç¤ºã—ãŸã‘れã°'center'(3行ã®ã†ã¡2番目ã®è¡Œã«è¡¨ç¤ºã•れる)ã€ä¸‹å¯„ã›ã§è¡¨ç¤ºã—ãŸã‘れã°'bottom'を指定ã™ã‚‹ã€‚ .. Specify how text within the TextBox should be aligned vertically. For example, if a text grid has 3 rows for text, and the text being displayed all fits on one row, the vertical justification determines if the text should be draw on the top row of the text grid (top), or should be centered on the rows ('center', in this example there would be one row above and below the row used to draw the text), or should be drawn on the last row of the text grid, ('bottom').