{"id":3173,"date":"2019-08-26T19:18:18","date_gmt":"2019-08-26T17:18:18","guid":{"rendered":"https:\/\/pythonprogramming.altervista.org\/?p=3173"},"modified":"2019-09-09T06:29:23","modified_gmt":"2019-09-09T04:29:23","slug":"animation-with-pygame","status":"publish","type":"post","link":"https:\/\/pythonprogramming.altervista.org\/animation-with-pygame\/","title":{"rendered":"Animation with Pygame"},"content":{"rendered":"<h2>Let&#8217;s animate some png files<\/h2>\n<p>Let&#8217;s say we got a bunch of files like these you can see below:<\/p>\n<p><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk01.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3462\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk01.png\" alt=\"\" width=\"150\" height=\"198\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk02.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3463\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk02.png\" alt=\"\" width=\"150\" height=\"198\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk03.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3464\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk03.png\" alt=\"\" width=\"150\" height=\"198\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk04.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3465\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk04.png\" alt=\"\" width=\"150\" height=\"198\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk05.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3466\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk05.png\" alt=\"\" width=\"150\" height=\"198\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk06.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3467\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk06.png\" alt=\"\" width=\"150\" height=\"198\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk07.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3468\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk07.png\" alt=\"\" width=\"150\" height=\"198\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk08.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3469\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk08.png\" alt=\"\" width=\"150\" height=\"198\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk09.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3470\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk09.png\" alt=\"\" width=\"150\" height=\"198\" \/><\/a> <a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk10.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3471\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/walk10.png\" alt=\"\" width=\"150\" height=\"198\" \/><\/a><\/p>\n<p>Whit pygame you can animate them and have something like this walking pumpkin guy that you can see in the following video:<\/p>\n<div style=\"width: 150px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3173-1\" width=\"150\" height=\"200\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/animate2.mp4?_=1\" \/><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/animate2.mp4\">https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/animate2.mp4<\/a><\/video><\/div>\n<p>Let&#8217;s check out how to do this with Python and the module pygame.<\/p>\n<p>The sprites can be <a href=\"https:\/\/www.simplifiedpython.net\/wp-content\/uploads\/2018\/06\/Sprites.zip\">downloaded here<\/a>.<\/p>\n<p>I took the code from <a href=\"https:\/\/www.simplifiedpython.net\/pygame-sprite-animation-tutorial\/#Creating_our_Sprite\">here<\/a>.<\/p>\n<p>I modified it a little bit to make it more compact and to avoid error messages at the end and the result was this.<\/p>\n<pre class=\"lang:default decode:true\">import pygame\r\nimport glob\r\n \r\nSIZE = WIDTH, HEIGHT = 150, 200 #the width and height of our screen\r\nFPS = 20 #Frames per second<\/pre>\n<p>This are just size and frame per seconds (higher value = higher speed).<\/p>\n<h2>The sprite class<\/h2>\n<p>Here is the main change that I made to the original code.<\/p>\n<pre class=\"lang:default decode:true\">self.images = [pygame.image.load(img) for img in glob.glob(\"images\\\\*.png\")]<\/pre>\n<p>This is a list comprehension, a way to write a loop in python. We could have done the same stuff with this:<\/p>\n<pre class=\"lang:default decode:true\">list_of_png = glob.glob(\"images\\\\*.png\") # a list with all png files in images folder\r\nfor image in list_of_png:\r\n   pygame.image.load(image)<\/pre>\n<p>The original code that the one I made above was like this:<\/p>\n<pre class=\"lang:default decode:true\">        self.images = []\r\n        self.images.append(pygame.image.load('images\/walk1.png'))\r\n        self.images.append(pygame.image.load('images\/walk2.png'))\r\n        self.images.append(pygame.image.load('images\/walk3.png'))\r\n        self.images.append(pygame.image.load('images\/walk4.png'))\r\n        self.images.append(pygame.image.load('images\/walk5.png'))\r\n        self.images.append(pygame.image.load('images\/walk6.png'))\r\n        self.images.append(pygame.image.load('images\/walk7.png'))\r\n        self.images.append(pygame.image.load('images\/walk8.png'))\r\n        self.images.append(pygame.image.load('images\/walk9.png'))\r\n        self.images.append(pygame.image.load('images\/walk10.png'))<\/pre>\n<p>As you can see, in one like I made the work that was done here with 11 line. I had to change the name of the files to walk0.png1, walk02.png&#8230; with a 0 before the one digit numbers, because otherwise the code would put walk10.png after walk1.png.<\/p>\n<p>There is just one porblem with my code. In the list_of_png the walk10.png goes after the walk1.png, instead of being the last one of the list. There are several way to fix this and it&#8217;s left to your imagination, but I posted a solution in <a href=\"https:\/\/pythonprogramming.altervista.org\/put-your-images-in-order-to-animate-them\/\">this post that you can read<\/a> (How to put a list of images in order) to see how I do it.<\/p>\n<p><iframe loading=\"lazy\" title=\"Python: order correctly a progressive numbered list of files\" width=\"747\" height=\"420\" src=\"https:\/\/www.youtube.com\/embed\/Pp-pQc-t7f4?feature=oembed&amp;enablejsapi=1\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>Another way to do that is to change the name of the files. It will be explained in the next paragraph.<\/p>\n<h2>How to change the name of the files<\/h2>\n<p>The previous method makes you have the right sequence of images <strong>without changing the names<\/strong> of the files.<\/p>\n<p>If,\u00a0 istead, you want fix the problem of the walk10.png after the walk1.png <strong>changing the names<\/strong> of the files and you do not want to change every file name manually, see in this video how I do:<\/p>\n<p><iframe loading=\"lazy\" title=\"Python: renaming a lot of files (os.rename)\" width=\"747\" height=\"420\" src=\"https:\/\/www.youtube.com\/embed\/Ut__8lyMKJ4?feature=oembed&amp;enablejsapi=1\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<pre class=\"lang:default decode:true\">class MySprite(pygame.sprite.Sprite):\r\n    def __init__(self):\r\n        super(MySprite, self).__init__()\r\n \r\n        self.images = [pygame.image.load(img) for img in glob.glob(\"images\\\\*.png\")]\r\n        self.index = 0\r\n        self.rect = pygame.Rect(5, 5, 150, 198)\r\n\r\n    def update(self):\r\n        if self.index &gt;= len(self.images):\r\n            self.index = 0\r\n        self.image = self.images[self.index]\r\n        self.index += 1<\/pre>\n<p>In this class we load the images and the update method makes the self.image be changed every frame that is called in the while loop below:<\/p>\n<pre class=\"lang:default decode:true \">def main():\r\n    pygame.init()\r\n    screen = pygame.display.set_mode(SIZE)\r\n    pygame.display.set_caption(\"Trace\")\r\n    my_sprite = MySprite()\r\n    my_group = pygame.sprite.Group(my_sprite)\r\n    clock = pygame.time.Clock()<\/pre>\n<p>After initialized, created the screen surface, title, loaded the sprites, added them to a Group and istanciated the Clock, comes the loop:<\/p>\n<pre class=\"lang:default decode:true \">    loop = 1\r\n    while loop:\r\n        for event in pygame.event.get():\r\n            if event.type == pygame.QUIT:\r\n                loop = 0\r\n \r\n        my_group.update()\r\n        screen.fill((0,0,0))\r\n        my_group.draw(screen)\r\n        pygame.display.update()\r\n        clock.tick(FPS)\r\n    pygame.quit()<\/pre>\n<p>Here (if you quit the window closes) you update the frame of sprite, clear the screen with black to avoid leaving traces on the screen, draw the sprite, update the screen at a certain frame rate.<\/p>\n<p>When you click the quit button pygame quits.<\/p>\n<p>The whole code:<\/p>\n<pre class=\"lang:default decode:true \">import pygame\r\nimport glob\r\n \r\nSIZE = WIDTH, HEIGHT = 150, 200 #the width and height of our screen\r\nFPS = 20 #Frames per second\r\n \r\nclass MySprite(pygame.sprite.Sprite):\r\n    def __init__(self):\r\n        super(MySprite, self).__init__()\r\n \r\n        self.images = [pygame.image.load(img) for img in glob.glob(\"images\\\\*.png\")]\r\n        self.index = 0\r\n        self.rect = pygame.Rect(5, 5, 150, 198)\r\n\r\n    def update(self):\r\n        if self.index &gt;= len(self.images):\r\n            self.index = 0\r\n        self.image = self.images[self.index]\r\n        self.index += 1\r\n \r\ndef main():\r\n    pygame.init()\r\n    screen = pygame.display.set_mode(SIZE)\r\n    pygame.display.set_caption(\"Trace\")\r\n    my_sprite = MySprite()\r\n    my_group = pygame.sprite.Group(my_sprite)\r\n    clock = pygame.time.Clock()\r\n    loop = 1\r\n    while loop:\r\n        for event in pygame.event.get():\r\n            if event.type == pygame.QUIT:\r\n                loop = 0\r\n \r\n        my_group.update()\r\n        screen.fill((0,0,0))\r\n        my_group.draw(screen)\r\n        pygame.display.update()\r\n        clock.tick(FPS)\r\n    pygame.quit()\r\n \r\nif __name__ == '__main__':\r\n    main()<\/pre>\n<h2><a href=\"https:\/\/pythonprogramming.altervista.org\/animation-on-pygame-2-free-characters-and-more-actions\/\">Go to the next episode<\/a><\/h2>\n<p><a href=\"https:\/\/pythonprogramming.altervista.org\/animation-on-pygame-2-free-characters-and-more-actions\/\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3306 size-full\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/08\/little.png\" alt=\"\" width=\"255\" height=\"166\" \/><\/a><\/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":"Animating sprites with Pygame\n<a class=\"moretag\" href=\"https:\/\/pythonprogramming.altervista.org\/animation-with-pygame\/\"> [...]<\/a>","protected":false},"author":1,"featured_media":3176,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[527,1,154,191],"tags":[219,194,510],"class_list":["post-3173","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-animation","category-examples","category-games","category-pygame","tag-animation","tag-pygame","tag-sprite"],"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\/3173","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=3173"}],"version-history":[{"count":9,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/3173\/revisions"}],"predecessor-version":[{"id":3473,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/3173\/revisions\/3473"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/media\/3176"}],"wp:attachment":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/media?parent=3173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/categories?post=3173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/tags?post=3173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}