{"id":2926,"date":"2019-08-14T20:14:42","date_gmt":"2019-08-14T18:14:42","guid":{"rendered":"https:\/\/pythonprogramming.altervista.org\/?p=2926"},"modified":"2019-08-19T06:43:52","modified_gmt":"2019-08-19T04:43:52","slug":"pygame-4-fonts","status":"publish","type":"post","link":"https:\/\/pythonprogramming.altervista.org\/pygame-4-fonts\/","title":{"rendered":"Pygame 4: fonts and how to center them"},"content":{"rendered":"<p>Let&#8217;s show how to put text into pygame. It&#8217;s a bit tricky, so let&#8217;s see how to do it. In a recent update of this post I added at the end some code to center the text on the screen, with a couple of methods. Go to read it clicking here if you want to know just that.<\/p>\n<p style=\"text-align: center;\">Previous edisodes:<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/pythonprogramming.altervista.org\/starting-with-pygame\/\">Pygame 1 &#8211; Starting with Pygame<\/a><\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/pythonprogramming.altervista.org\/pygame-drawing-2\/\">Pygame 2 &#8211; Drawing<\/a><\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/pythonprogramming.altervista.org\/pygame-3-move-sprite\/\">Pygame 3 &#8211; Moving sprites<\/a><\/p>\n<h2>Fonts rendering<\/h2>\n<p>In this 4th episode of &#8220;Pygame&#8221; we are gonna talk about fonts. You will have to write something on the screen, right? A score at least. What is a game without scores? To gain a higher score is the reason for the game exists. So, to see fonts you will have to<\/p>\n<ul>\n<li>initialize them with pygame.init() or pygame.font.init(), if you do not want to get an error\n<ul>\n<li><strong class=\"coral\">pygame.font.init()<\/strong><\/li>\n<\/ul>\n<\/li>\n<li>initialize a specific a font type with pygame.font.SysFont\n<ul>\n<li><strong class=\"coral\">font = pygame.font.<\/strong><\/li>\n<li><strong class=\"coral\">SysFont(&#8220;Arial&#8221;, 72)<\/strong><\/li>\n<\/ul>\n<\/li>\n<li>then you will render that font type with some txt and color\n<ul>\n<li><strong class=\"coral\">text = font.render(&#8220;Start game&#8221;, True, (255,255,255)<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Furthermore, you will have to do the usual stuff.<\/p>\n<ul>\n<li>initialize a SURFACE (the screen on wich we will draw)\n<ul>\n<li><strong class=\"coral\">SURF = pygame.display.set_mode((600, 400))<\/strong><\/li>\n<\/ul>\n<\/li>\n<li>create a loop to display stuffs\n<ul>\n<li><strong class=\"coral\">while loop == True:<\/strong><\/li>\n<\/ul>\n<\/li>\n<li>use blit to display every text rendered(to display the text rendered above in the var text)\n<ul>\n<li><strong class=\"coral\">SURF.blit(text, (100,150))<\/strong><\/li>\n<\/ul>\n<\/li>\n<li>clear the screen at each frame if something moves\n<ul>\n<li><strong class=\"coral\">SURF.fill((0,0,0))<\/strong><\/li>\n<\/ul>\n<\/li>\n<li>Update the screen for each frame\n<ul>\n<li><strong class=\"coral\">pygame.display.update()<\/strong><\/li>\n<\/ul>\n<\/li>\n<li>ensure that you can close the window correctly with this code (<strong>for e in pygame.event.get()<\/strong>):\n<ul>\n<li><strong class=\"coral\">if e.type == QUIT: loop = 0<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>I wanted to make something move nicely, instead of having everything still, so I added a little trick we just used in the previous three episodes, i.e. to link the position of the second text to the mouse.<\/p>\n<pre class=\"lang:default decode:true \">x, y = pygame.mouse.get_pos()<\/pre>\n<pre class=\"lang:default decode:true\">SURF.blit(restart, (x, y))<\/pre>\n<p>So, feel free to move around the mouse to see how the text will gently follow you around the black screen.<\/p>\n<h2>Show me some fonts<\/h2>\n<p>Here is the code. Save it as something.py and run it with the cmd typing python something.py.<\/p>\n<pre class=\"lang:default decode:true\">import pygame\r\nfrom pygame.locals import *\r\n\r\npygame.init()\r\npygame.font.init()\r\n# font object..................................\r\ndef create_font(t,s=72,c=(255,255,0), b=False,i=False):\r\n    font = pygame.font.SysFont(\"Arial\", s, bold=b, italic=i)\r\n    text = font.render(t, True, c)\r\n    return text\r\n# Text to be rendered with create_font    \r\ngame_over = create_font(\"GAME OVER\")\r\nrestart = create_font(\"Press Space to restart\", 36, (9,0,180))\r\n\r\nSURF = pygame.display.set_mode((600, 400))\r\nloop = True\r\nclock = pygame.time.Clock()\r\nwhile loop == True:\r\n    SURF.fill((0,0,0))\r\n    x, y = pygame.mouse.get_pos()\r\n    SURF.blit(game_over, (100,150))\r\n    SURF.blit(restart, (x, y))\r\n    for e in pygame.event.get():\r\n        if e.type == QUIT:\r\n            loop = 0\r\n    pygame.display.update()\r\n    clock.tick(60)\r\n\r\npygame.quit()<\/pre>\n<p>This is the (static) result of the code:<a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/fonts.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-2929 aligncenter\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/fonts.jpg\" alt=\"\" width=\"599\" height=\"410\" srcset=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/fonts.jpg 599w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/fonts-320x219.jpg 320w\" sizes=\"auto, (max-width: 599px) 100vw, 599px\" \/><\/a>This is the dynamic version:<\/p>\n<h2>About SysFont<\/h2>\n<p>Let&#8217;s read what is SysFont typing:<\/p>\n<pre class=\"lang:default decode:true \">help(pygame.font.SysFont)<\/pre>\n<p>&#8230;<\/p>\n<blockquote><p>Help on function SysFont in module pygame.sysfont: SysFont(name, size, bold=False, italic=False, constructor=None) pygame.font.SysFont(name, size, bold=False, italic=False, constructor=None) -&gt; Font create a pygame Font from system font resources This will search the system fonts for the given font name. You can also enable bold or italic styles, and the appropriate system font will be selected if available. This will always return a valid Font object, and will fallback on the builtin pygame font if the given font is not found. Name can also be a comma separated list of names, in which case set of names will be searched in order. Pygame uses a small set of common font aliases, if the specific font you ask for is not available, a reasonable alternative may be used. if optional contructor is provided, it must be a function with signature constructor(fontpath, size, bold, italic) which returns a Font instance. If None, a pygame.font.Font object is created.<\/p><\/blockquote>\n<div style=\"width: 747px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-2926-1\" width=\"747\" height=\"420\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/output5.mp4?_=1\" \/><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/output5.mp4\">https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/output5.mp4<\/a><\/video><\/div>\n<h2>How to center text?<\/h2>\n<p>If you want to center text you can make two things:<\/p>\n<ul>\n<li>use the get_width and get_height methods from the surface and divide them by two, create a<\/li>\n<\/ul>\n<h3>Initiate pygame, fonts and screen<\/h3>\n<pre class=\"lang:default decode:true \">import pygame\r\nfrom pygame.locals import *\r\n\r\npygame.init()\r\npygame.font.init()\r\nSURF = pygame.display.set_mode((600, 400))<\/pre>\n<h3>Create a function that returns&#8230;<\/h3>\n<p>This function returns the text rendered and the coordinate of the text in textRect obtained with get_rect()<\/p>\n<pre class=\"lang:default decode:true\">def create_font(t,s=72,c=(255,255,0), b=False,i=False):\r\n    font = pygame.font.SysFont(\"Arial\", s, bold=b, italic=i)\r\n    text = font.render(t, True, c)\r\n    textRect = text.get_rect()\r\n    return text,textRect<\/pre>\n<h3>Use the function to create two text with relative &#8216;textRect&#8217;<\/h3>\n<pre class=\"lang:default decode:true \">game_over, gobox = create_font(\"GAME OVER\")\r\nrestart, rbox = create_font(\"Press Space to restart\", 36, (9,0,180))<\/pre>\n<h3>First method to center the first text<\/h3>\n<p>The gobox label will point to a Rectangle object that has the center in the middle (centerx and centery that are obtained with SURF.get_width() \/\/ 2 and SURF-get_width() \/\/ 2.<\/p>\n<pre class=\"lang:default decode:true \">centerx, centery = SURF.get_width() \/\/ 2, SURF.get_height() \/\/ 2\r\ngobox = game_over.get_rect(center=(centerx, centery))<\/pre>\n<p>This will go in the loop to display the &#8216;game&#8217; here:<\/p>\n<p>you pass to blit the rendered text (game_over) and the Rectangle in wich the text is contained, centered as we&#8217;ve seen above in the gobox object.<\/p>\n<pre class=\"lang:default decode:true\">SURF.blit(game_over, gobox)<\/pre>\n<h3>Second method for the second text<\/h3>\n<p>This text will be centered only horizontally.<\/p>\n<p>We create a new attribute for the restart rendered text who&#8217;s value are a tuple with the centered width and as height you just have the height of the text itself (so that it as the same distance from the top as the height of the text&#8230; it&#8217;s not centerd vertically, only horizontally, as you can see in the image below. If you wanted to center this text in this way also vertically you should have put as height: SURF.get_height() \/\/ 2. I did no do it to avoid writing this text over the first text.<\/p>\n<pre class=\"lang:default decode:true\">rbox = int((SURF.get_width() - restart.get_width())\/\/2), restart.get_height()<\/pre>\n<p>The relative blit function in the loop will be:<\/p>\n<pre class=\"lang:default decode:true\">SURF.blit(restart, rbox)<\/pre>\n<p>Note that in the first method you passed gobox and in this<\/p>\n<h3>The loop<\/h3>\n<pre class=\"lang:default decode:true \">loop = True\r\nclock = pygame.time.Clock()\r\nwhile loop == True:\r\n    SURF.fill((0,0,0))\r\n    x, y = pygame.mouse.get_pos()\r\n    SURF.blit(game_over, gobox)\r\n    SURF.blit(restart, rbox)\r\n    for e in pygame.event.get():\r\n        if e.type == QUIT:\r\n            loop = 0\r\n    pygame.display.update()\r\n    clock.tick(60)\r\n\r\npygame.quit()<\/pre>\n<p>The ouput:<\/p>\n<p><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/gameover.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3033 aligncenter\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/gameover.png\" alt=\"\" width=\"602\" height=\"432\" srcset=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/gameover.png 602w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/gameover-320x230.png 320w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/gameover-321x229.png 321w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/a>Notice the difference with the first image with the same text (just look at Game Over, because the other text was being moved by the mouse, so it was not centered).<\/p>\n<h3>Pygame's Platform Game<\/h3>\r\n\r\n<a href=\"https:\/\/pythonprogramming.altervista.org\/pygame-platform-game-5-sounds-and-mixer\/\"><img decoding=\"async\" src=\"https:\/\/i1.wp.com\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/climbercover.png?w=557&ssl=1\"\/ width=\"50%\"><\/a>\r\n<script>\r\nvar title = \"Platform Pygame\";\r\n\t\tvar links = [\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-animation-of-a-sprite-v-1-3\/\",\"Animation 1.3\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-sprite-animation-v-2-better-coding-test-it-checking-fps-on-the-screen\/\",\"Animation 1.2\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-how-to-display-the-frame-rate-fps-on-the-screen\/\",\"Display Frame rate\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-sprite-animation-update\/\",\"Animation 1.1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-platformer-1\/\",\"Pygame Platform Game 1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/python-platform-game-2\/\",\"Pygame Platform 2\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-platform-game-3-recap-cheatsheet\/\",\"Pygame PLatform 3 - recap and some Cheat Sheet\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-platform-game-4-background-and-stuffs\/\",\"Pygame Platform 4 - Background & organizing code\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-platform-game-5-sounds-and-mixer\/\",\"Pygame Platform 5 - Sounds\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/platform-game-in-detail-part-1\/\",\"Game in detail part 1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/map-maker-1-2\/\", \"Map maker 1.2\"]\r\n\t\t];\r\n\t\t<\/script>\r\n<script>\r\n\t\r\nif (typeof next2 != \"undefined\"){let next2 = 0;}\r\n\t\r\nnext2 = 0;\r\n\thtml = \"\";\/\/<b style='color:coral;font-size:1.2em'>Other posts about \" + title + \"<\/b><br>\";\r\nfor (address of links) \r\n{\r\n\r\n\tif (next2 == 1){\r\n\t\thtml += \"<div style='background:coral'>\";\r\n\t\thtml += \"Next link => <a href='\" + address[0] + \"'>\" + address[1] + \"<\/a>\";\r\n\t\thtml += \"<\/div><br>\";\r\n\t\tnext2 = 0;\r\n\t}\r\n\tif (address[0] == document.URL) {\r\n\t\tnext2 = 1;\r\n\t}\r\n}\r\n\r\nif (typeof next != \"undefined\") {let next = 0;}\r\nif (typeof addressStart != \"undefined\") {let addressStart = \"\";}\r\nnext = 0;\r\naddressStart = \"<a href='\";\r\nfor (address of links) {\r\n\tif (next == 1){\r\n\t\thtml += \">>>\" + addressStart + address[0] + \"'>\" + address[1] + \"<\/a><br>\";\r\n\t\tnext = 0;\r\n\t}\r\n\telse if (addressStart + address[0] != document.URL)\r\n\t{\r\n\t\thtml += addressStart + address[0] + \"'>\" + address[1] + \"<\/a><br>\";\r\n\t}\r\n\telse\r\n\t{\r\n\t\tnext = 1;\r\n\t\tnext_address = address[0]\r\n\t\tnext_title = address[1]\r\n\t\thtml += \"<span style='color:gray'>\" + address[1] + \"<\/span><br>\";\r\n\t}\r\n\r\n}\r\n\r\n\thtml += `<span style=\"font-size:8px\">Powered by <a href=\"https:\/\/pythonprogramming.altervista.org\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2673\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2.png\" alt=\"\" width=\"70\" height=\"25\" srcset=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2.png 156w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2-150x56.png 150w\" sizes=\"auto, (max-width: 70px) 100vw, 70px\" \/>pythonprogramming.altervista.org<\/a><\/span>`\r\n\thtml = \"<div style='background:yellow'>\" + html + \"<\/div>\";\r\n\tdocument.write(html)\r\n<\/script>\r\n\r\n<h3>Other Pygame's posts<\/h3>\r\n\r\n<script>\r\nvar title = \"Pygame's Posts\"\r\nvar links = [\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-platformer-1\/\",\"Platform game 1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/make-a-platform-game-with-pygame-dafluffypotato\/\",\"DaFluffyPotato Platform Tutorials\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/python-and-classic-arcade-games-pong\/\",\"Pong Game Full\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/python-draws-in-colors-app-to-draw-with-pygame\/\",\"PyGameGIF 2\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-draw-app-with-animation\/\",\"PyGameGIF 1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pydraw-2-0-app-to-draw-gif\/\",\"PyDraw 2.0\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-drawing-2\/\",\"Draw with Pygame\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/animation-with-pygame\",\"Sprite animation 1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/animation-on-pygame-2-free-characters-and-more-actions\/\",\"Sprite animation 2\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/starting-with-pygame\/\",\"Starting movements with Pygame\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-3-move-sprite\/\", \"Move a Sprite\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-4-fonts\/\",\"Text and Fonts\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-animate-a-sprite\/\", \"Animate a sprite\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-and-mouse-events\/\",\"Mouse events\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pgp-aka-pygamepresentation-project\/\",\"Pygame presentation\"],\r\n\t[\"https:\/\/pythonprogramming.altervista.org\/moving-the-player-in-pygame-with-key-get_pressed\/\",\"How to use key.get_pressed()\"]\r\n]\r\n<\/script>\r\n\r\n\r\n<script>\r\n\t\r\nif (typeof next2 != \"undefined\"){let next2 = 0;}\r\n\t\r\nnext2 = 0;\r\n\thtml = \"\";\/\/<b style='color:coral;font-size:1.2em'>Other posts about \" + title + \"<\/b><br>\";\r\nfor (address of links) \r\n{\r\n\r\n\tif (next2 == 1){\r\n\t\thtml += \"<div style='background:coral'>\";\r\n\t\thtml += \"Next link => <a href='\" + address[0] + \"'>\" + address[1] + \"<\/a>\";\r\n\t\thtml += \"<\/div><br>\";\r\n\t\tnext2 = 0;\r\n\t}\r\n\tif (address[0] == document.URL) {\r\n\t\tnext2 = 1;\r\n\t}\r\n}\r\n\r\nif (typeof next != \"undefined\") {let next = 0;}\r\nif (typeof addressStart != \"undefined\") {let addressStart = \"\";}\r\nnext = 0;\r\naddressStart = \"<a href='\";\r\nfor (address of links) {\r\n\tif (next == 1){\r\n\t\thtml += \">>>\" + addressStart + address[0] + \"'>\" + address[1] + \"<\/a><br>\";\r\n\t\tnext = 0;\r\n\t}\r\n\telse if (addressStart + address[0] != document.URL)\r\n\t{\r\n\t\thtml += addressStart + address[0] + \"'>\" + address[1] + \"<\/a><br>\";\r\n\t}\r\n\telse\r\n\t{\r\n\t\tnext = 1;\r\n\t\tnext_address = address[0]\r\n\t\tnext_title = address[1]\r\n\t\thtml += \"<span style='color:gray'>\" + address[1] + \"<\/span><br>\";\r\n\t}\r\n\r\n}\r\n\r\n\thtml += `<span style=\"font-size:8px\">Powered by <a href=\"https:\/\/pythonprogramming.altervista.org\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2673\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2.png\" alt=\"\" width=\"70\" height=\"25\" srcset=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2.png 156w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2-150x56.png 150w\" sizes=\"auto, (max-width: 70px) 100vw, 70px\" \/>pythonprogramming.altervista.org<\/a><\/span>`\r\n\thtml = \"<div style='background:yellow'>\" + html + \"<\/div>\";\r\n\tdocument.write(html)\r\n<\/script>\n","protected":false},"excerpt":{"rendered":"Render fonts on the screen with Pygame\n<a class=\"moretag\" href=\"https:\/\/pythonprogramming.altervista.org\/pygame-4-fonts\/\"> [...]<\/a>","protected":false},"author":1,"featured_media":2928,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1,154,191],"tags":[194],"class_list":["post-2926","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-examples","category-games","category-pygame","tag-pygame"],"avopt_banners_inside_post":true,"avopt_banners_on_page":true,"av_copy_from":"","av_sharing_message":"","av_sharing_allowed":false,"av_sharing_on":{"fb":[],"tw":[]},"av_allow_affiliate_banner":false,"av_allow_affiliate_multi_banner":false,"av_show_affiliation_buy_button":false,"av_post_rating":true,"av_have_post_rating_value":false,"av_is_artificial_intelligence_content":false,"_links":{"self":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/2926","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/comments?post=2926"}],"version-history":[{"count":10,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/2926\/revisions"}],"predecessor-version":[{"id":2934,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/2926\/revisions\/2934"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/media\/2928"}],"wp:attachment":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/media?parent=2926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/categories?post=2926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/tags?post=2926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}