{"action":"created","issue":{"url":"https://api.github.com/repos/psychopy/psychopy/issues/928","repository_url":"https://api.github.com/repos/psychopy/psychopy","labels_url":"https://api.github.com/repos/psychopy/psychopy/issues/928/labels{/name}","comments_url":"https://api.github.com/repos/psychopy/psychopy/issues/928/comments","events_url":"https://api.github.com/repos/psychopy/psychopy/issues/928/events","html_url":"https://github.com/psychopy/psychopy/issues/928","id":90712606,"number":928,"title":"Cannot retrieve the size of rendered text with pyglet","user":{"login":"tmalsburg","id":3817450,"avatar_url":"https://avatars3.githubusercontent.com/u/3817450?v=3","gravatar_id":"","url":"https://api.github.com/users/tmalsburg","html_url":"https://github.com/tmalsburg","followers_url":"https://api.github.com/users/tmalsburg/followers","following_url":"https://api.github.com/users/tmalsburg/following{/other_user}","gists_url":"https://api.github.com/users/tmalsburg/gists{/gist_id}","starred_url":"https://api.github.com/users/tmalsburg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmalsburg/subscriptions","organizations_url":"https://api.github.com/users/tmalsburg/orgs","repos_url":"https://api.github.com/users/tmalsburg/repos","events_url":"https://api.github.com/users/tmalsburg/events{/privacy}","received_events_url":"https://api.github.com/users/tmalsburg/received_events","type":"User","site_admin":false},"labels":[{"id":95698,"url":"https://api.github.com/repos/psychopy/psychopy/labels/enhancement","name":"enhancement","color":"02d7e1","default":true},{"id":459920130,"url":"https://api.github.com/repos/psychopy/psychopy/labels/library","name":"library","color":"fef2c0","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2015-06-24T15:38:42Z","updated_at":"2017-03-15T15:10:37Z","closed_at":"2017-03-15T15:10:37Z","body":"I need the size of a rendered text. When using pygame as the backend, I could use the following code which renders a text and then calculates and renders the bounding box of the text:\n\n``` Python\n    from psychopy import visual, core\n\n    width = 600\n    height = 300\n    x = (-width / 2) + 20\n    y = 0\n\n    win = visual.Window([width,height], monitor=\"testMonitor\", units=\"deg\", fullscr=False, winType=\"pyglet\")\n\n    msg = visual.TextStim(win, text=u\"\\u00A1Hola mundo!\", pos=(x,y), alignHoriz=\"left\", alignVert=\"center\", font=\"Comic Sans MS\", height=30, units=\"pix\")\n\n    x1 = x\n    x2 = x + msg.width\n    y1 = y - msg.height/2\n    y2 = y + msg.height/2\n\n    print x1,x2,y1,y2\n\n    rec = visual.Rect(win, x2-x1, y2-y1, units=\"pix\", lineColor=(1,0,0), lineWidth=2, pos=((x1+x2)/2, (y1+y2)/2))\n\n    msg.draw()\n    rec.draw()\n    win.flip()\n\n    core.wait(4)\n    win.close()\n```\n\n`Text.Stim.width` is not documented but it gives me the correct value.\n\nHowever, when I use pyglet, both width and height are too large.  See the attached image:\n\n![screenshot_2015-06-24082518](https://cloud.githubusercontent.com/assets/3817450/8334282/ec2cef96-1a4b-11e5-98ba-96f8453efbb2.png)\n\nThe documentation `TextStim.size` says that `TextStim._sizeRendered` can be used to retrieve the actual rendered size but when I try this, I get an AttributeError:\n\n```\n>>> msg._sizeRendered\nTraceback (most recent call last):\n  File \"<stdin>\", line 1, in <module>\nAttributeError: 'TextStim' object has no attribute '_sizeRendered'\n```\n\nI would just use pygame but see #927.\n"},"comment":{"url":"https://api.github.com/repos/psychopy/psychopy/issues/comments/286772250","html_url":"https://github.com/psychopy/psychopy/issues/928#issuecomment-286772250","issue_url":"https://api.github.com/repos/psychopy/psychopy/issues/928","id":286772250,"user":{"login":"peircej","id":380582,"avatar_url":"https://avatars1.githubusercontent.com/u/380582?v=3","gravatar_id":"","url":"https://api.github.com/users/peircej","html_url":"https://github.com/peircej","followers_url":"https://api.github.com/users/peircej/followers","following_url":"https://api.github.com/users/peircej/following{/other_user}","gists_url":"https://api.github.com/users/peircej/gists{/gist_id}","starred_url":"https://api.github.com/users/peircej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peircej/subscriptions","organizations_url":"https://api.github.com/users/peircej/orgs","repos_url":"https://api.github.com/users/peircej/repos","events_url":"https://api.github.com/users/peircej/events{/privacy}","received_events_url":"https://api.github.com/users/peircej/received_events","type":"User","site_admin":false},"created_at":"2017-03-15T15:10:37Z","updated_at":"2017-03-15T15:10:37Z","body":"TextStim.boundingBox was added in v1.83.00 \r\ncommit 35c168f1"}}
{"actor":{"display_login":"peircej"}}