{"action":"created","issue":{"url":"https://api.github.com/repos/openai/gym/issues/1016","repository_url":"https://api.github.com/repos/openai/gym","labels_url":"https://api.github.com/repos/openai/gym/issues/1016/labels{/name}","comments_url":"https://api.github.com/repos/openai/gym/issues/1016/comments","events_url":"https://api.github.com/repos/openai/gym/issues/1016/events","html_url":"https://github.com/openai/gym/issues/1016","id":317153533,"node_id":"MDU6SXNzdWUzMTcxNTM1MzM=","number":1016,"title":"How to draw text ? ","user":{"login":"Gasp34","id":38688186,"node_id":"MDQ6VXNlcjM4Njg4MTg2","avatar_url":"https://avatars2.githubusercontent.com/u/38688186?v=4","gravatar_id":"","url":"https://api.github.com/users/Gasp34","html_url":"https://github.com/Gasp34","followers_url":"https://api.github.com/users/Gasp34/followers","following_url":"https://api.github.com/users/Gasp34/following{/other_user}","gists_url":"https://api.github.com/users/Gasp34/gists{/gist_id}","starred_url":"https://api.github.com/users/Gasp34/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gasp34/subscriptions","organizations_url":"https://api.github.com/users/Gasp34/orgs","repos_url":"https://api.github.com/users/Gasp34/repos","events_url":"https://api.github.com/users/Gasp34/events{/privacy}","received_events_url":"https://api.github.com/users/Gasp34/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-24T09:56:14Z","updated_at":"2019-06-07T11:54:29Z","closed_at":"2019-03-22T23:02:57Z","author_association":"NONE","body":"Here is my function render, do you have any idea of how i can draw text on the same window ? \r\n\r\ndef render(self):\r\n\r\n        screen_width = 1000\r\n        screen_height = 1000\r\n        cell_width = screen_width / self.num_states[1]\r\n        cell_height = screen_height / self.num_states[0]\r\n\r\n\r\n        if self.viewer is None:\r\n            from gym.envs.classic_control import rendering\r\n            self.viewer = rendering.Viewer(screen_width,screen_height)\r\n\r\n            l,r,t,b = 0, cell_width, cell_height, 0\r\n            cell = rendering.FilledPolygon([(l,b), (l,t), (r,t), (r,b)])\r\n            cell.set_color(0,0,1) # blue for current state\r\n\r\n            x=self.terminal_state[1]*cell_width\r\n            y=self.terminal_state[0]*cell_height\r\n            end = rendering.FilledPolygon([(x+l,y+b), (x+l,y+t), (x+r,y+t), (x+r,y+b)])\r\n            end.set_color(1,0,0) # red for end state (note : end state is 0)\r\n\r\n            for i in range(self.num_states[0]):\r\n                for j in range(self.num_states[1]):\r\n                    if self.mur_inv[i][j]==1:\r\n                        x=j*cell_width\r\n                        y=i*cell_height\r\n                        mur = rendering.FilledPolygon([(x+l,y+b), (x+l,y+t), (x+r,y+t), (x+r,y+b)])\r\n                        mur.set_color(0,0,0)\r\n                        self.viewer.add_geom(mur)\r\n\r\n\r\n            self.viewer.add_geom(end)\r\n            self.celltrans = rendering.Transform()\r\n            cell.add_attr(self.celltrans)\r\n            self.viewer.add_geom(cell)\r\n\r\n        if self.current_state is None: return None\r\n\r\n        statex = self.current_state[1]\r\n        statey = self.current_state[0]\r\n        cellx = statex*cell_width\r\n        celly = statey*cell_height\r\n        self.celltrans.set_translation(cellx,celly)\r\n\r\n\r\n        time.sleep(0)\r\n\r\n\r\n        return self.viewer.render()"},"comment":{"url":"https://api.github.com/repos/openai/gym/issues/comments/499856778","html_url":"https://github.com/openai/gym/issues/1016#issuecomment-499856778","issue_url":"https://api.github.com/repos/openai/gym/issues/1016","id":499856778,"node_id":"MDEyOklzc3VlQ29tbWVudDQ5OTg1Njc3OA==","user":{"login":"abelokon955","id":39626151,"node_id":"MDQ6VXNlcjM5NjI2MTUx","avatar_url":"https://avatars0.githubusercontent.com/u/39626151?v=4","gravatar_id":"","url":"https://api.github.com/users/abelokon955","html_url":"https://github.com/abelokon955","followers_url":"https://api.github.com/users/abelokon955/followers","following_url":"https://api.github.com/users/abelokon955/following{/other_user}","gists_url":"https://api.github.com/users/abelokon955/gists{/gist_id}","starred_url":"https://api.github.com/users/abelokon955/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abelokon955/subscriptions","organizations_url":"https://api.github.com/users/abelokon955/orgs","repos_url":"https://api.github.com/users/abelokon955/repos","events_url":"https://api.github.com/users/abelokon955/events{/privacy}","received_events_url":"https://api.github.com/users/abelokon955/received_events","type":"User","site_admin":false},"created_at":"2019-06-07T11:54:29Z","updated_at":"2019-06-07T11:54:29Z","author_association":"NONE","body":"Hi could you please elaborate, how to implement it into the upper example?\r\nWe added the following code but there is no text being displayed:\r\n```\r\n\r\n            self.score_label = pyglet.text.Label('0000', font_size=36,\r\n                x=20, y=WINDOW_H*2.5/40.00, anchor_x='left', anchor_y='center',\r\n                color=(255,255,255,255))\r\n\r\n        self.score_label.text = \"Hello World\"\r\n        self.score_label.draw()\r\n\r\n```"}}
{"actor":{"display_login":"abelokon955"}}