{"id":1930,"date":"2022-12-10T21:23:16","date_gmt":"2022-12-11T02:23:16","guid":{"rendered":"https:\/\/blog.lufamily.ca\/kang\/?p=1930"},"modified":"2023-05-21T15:24:46","modified_gmt":"2023-05-21T19:24:46","slug":"a-weekend-programming-challenge","status":"publish","type":"post","link":"https:\/\/blog.lufamily.ca\/kang\/2022\/12\/10\/a-weekend-programming-challenge\/","title":{"rendered":"A Weekend Programming Challenge"},"content":{"rendered":"\n<p>My wife and I were watching &nbsp;<a href=\"https:\/\/mydramalist.com\/68429-the-lighter-and-the-princess-gown\">Lighter &amp; Princess (<\/a><a rel=\"noreferrer noopener\" href=\"https:\/\/mydramalist.com\/68429-the-lighter-and-the-princess-gown\" target=\"_blank\">\u70b9\u71c3<\/a><a href=\"https:\/\/mydramalist.com\/68429-the-lighter-and-the-princess-gown\">\u6211\uff0c\u6e29\u6696\u4f60)<\/a>. In episode 5, a smart programmer completed a heart animation as part of a programming test in a university course. Everyone of his classmates had a mediocre and simplistic implementation.<\/p>\n\n\n\n<p>My wife challenged me to do the same. I could have done this with SVG and Javascript, but I took the opportunity to learn more Python and Qt. The latter I have not used at all and was always curious how well it worked with Python. I decided to use the PyQt package instead of the PySide package.<\/p>\n\n\n\n<p>I hacked this together today resulting in this rendition:<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"958\" style=\"aspect-ratio: 1200 \/ 958;\" width=\"1200\" autoplay controls loop poster=\"https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2022\/12\/heart.jpg\" src=\"https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2022\/12\/heartVideo.mp4\"><\/video><figcaption class=\"wp-element-caption\">Click above to see it in action<\/figcaption><\/figure>\n\n\n\n<p>The PyQt implementation worked really well across Windows, Mac, and Ubuntu Linux. I suppose the Javascript and SVG would have done the same, but I learned something new in this case.<\/p>\n\n\n\n<p>The source code and the installation instructions are at:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/github.com\/kanglu\/heart\"><img loading=\"lazy\" decoding=\"async\" width=\"705\" height=\"462\" src=\"https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2022\/12\/Screenshot-2022-12-10-at-9.19.21-PM.png\" alt=\"\" class=\"wp-image-1937\" srcset=\"https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2022\/12\/Screenshot-2022-12-10-at-9.19.21-PM.png 705w, https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2022\/12\/Screenshot-2022-12-10-at-9.19.21-PM-300x197.png 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/a><figcaption class=\"wp-element-caption\">Click above to goto GitHub<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>My wife and I were watching &nbsp;Lighter &amp; Princess (\u70b9\u71c3\u6211\uff0c\u6e29\u6696\u4f60). In episode 5, a smart programmer completed a heart animation as part of a programming test in a university course. Everyone of his classmates had a mediocre and simplistic implementation. My wife challenged me to do the same. I could have done this with SVG &hellip; <a href=\"https:\/\/blog.lufamily.ca\/kang\/2022\/12\/10\/a-weekend-programming-challenge\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;A Weekend Programming Challenge&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[111],"tags":[112,140,98],"class_list":["post-1930","post","type-post","status-publish","format-standard","hentry","category-tech","tag-programming","tag-software","tag-tech"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7V6i8-v8","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts\/1930","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/comments?post=1930"}],"version-history":[{"count":4,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts\/1930\/revisions"}],"predecessor-version":[{"id":1939,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts\/1930\/revisions\/1939"}],"wp:attachment":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/media?parent=1930"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/categories?post=1930"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/tags?post=1930"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}