{"id":81,"date":"2025-12-05T16:13:31","date_gmt":"2025-12-05T16:13:31","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/d_harkless\/?p=81"},"modified":"2025-12-05T16:13:31","modified_gmt":"2025-12-05T16:13:31","slug":"free-friday-12-5-25","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/d_harkless\/2025\/12\/05\/free-friday-12-5-25\/","title":{"rendered":"Free Friday 12\/5\/25"},"content":{"rendered":"\n<p>Today in class I made a GUI calculator.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Simple GUI Calculator in Python\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/NzSCNjn4_RI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"298\" height=\"297\" src=\"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-content\/uploads\/2025\/12\/image-2.png\" alt=\"\" class=\"wp-image-84\" style=\"width:223px;height:auto\" srcset=\"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-content\/uploads\/2025\/12\/image-2.png 298w, https:\/\/theroyalscode.com\/students\/d_harkless\/wp-content\/uploads\/2025\/12\/image-2-150x150.png 150w\" sizes=\"auto, (max-width: 298px) 100vw, 298px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"304\" height=\"302\" src=\"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-content\/uploads\/2025\/12\/image-3.png\" alt=\"\" class=\"wp-image-85\" style=\"width:221px;height:auto\" srcset=\"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-content\/uploads\/2025\/12\/image-3.png 304w, https:\/\/theroyalscode.com\/students\/d_harkless\/wp-content\/uploads\/2025\/12\/image-3-300x298.png 300w, https:\/\/theroyalscode.com\/students\/d_harkless\/wp-content\/uploads\/2025\/12\/image-3-150x150.png 150w\" sizes=\"auto, (max-width: 304px) 100vw, 304px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"297\" height=\"299\" src=\"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-content\/uploads\/2025\/12\/image-6.png\" alt=\"\" class=\"wp-image-88\" style=\"width:226px;height:auto\" srcset=\"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-content\/uploads\/2025\/12\/image-6.png 297w, https:\/\/theroyalscode.com\/students\/d_harkless\/wp-content\/uploads\/2025\/12\/image-6-150x150.png 150w\" sizes=\"auto, (max-width: 297px) 100vw, 297px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"289\" height=\"303\" src=\"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-content\/uploads\/2025\/12\/image-7.png\" alt=\"\" class=\"wp-image-89\" style=\"width:223px;height:auto\" srcset=\"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-content\/uploads\/2025\/12\/image-7.png 289w, https:\/\/theroyalscode.com\/students\/d_harkless\/wp-content\/uploads\/2025\/12\/image-7-286x300.png 286w\" sizes=\"auto, (max-width: 289px) 100vw, 289px\" \/><\/figure>\n\n\n\n<p>This is the code for the buttons on the calculator:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>btn_1 = tk.Button(root, text=\"1\", command=lambda: add_to_calculation(1), width=5, font=(\"Arial\", 14))\nbtn_1.grid(row=2, column=1)\nbtn_2 = tk.Button(root, text=\"2\", command=lambda: add_to_calculation(2), width=5, font=(\"Arial\", 14))\nbtn_2.grid(row=2, column=2)\nbtn_3 = tk.Button(root, text=\"3\", command=lambda: add_to_calculation(3), width=5, font=(\"Arial\", 14))\nbtn_3.grid(row=2, column=3)\nbtn_4 = tk.Button(root, text=\"4\", command=lambda: add_to_calculation(4), width=5, font=(\"Arial\", 14))\nbtn_4.grid(row=3, column=1)\nbtn_5 = tk.Button(root, text=\"5\", command=lambda: add_to_calculation(5), width=5, font=(\"Arial\", 14))\nbtn_5.grid(row=3, column=2)\nbtn_6 = tk.Button(root, text=\"6\", command=lambda: add_to_calculation(6), width=5, font=(\"Arial\", 14))\nbtn_6.grid(row=3, column=3)\nbtn_7 = tk.Button(root, text=\"7\", command=lambda: add_to_calculation(7), width=5, font=(\"Arial\", 14))\nbtn_7.grid(row=4, column=1)\nbtn_8 = tk.Button(root, text=\"8\", command=lambda: add_to_calculation(8), width=5, font=(\"Arial\", 14))\nbtn_8.grid(row=4, column=2)\nbtn_9 = tk.Button(root, text=\"9\", command=lambda: add_to_calculation(9), width=5, font=(\"Arial\", 14))\nbtn_9.grid(row=4, column=3)\nbtn_0 = tk.Button(root, text=\"0\", command=lambda: add_to_calculation(0), width=5, font=(\"Arial\", 14))\nbtn_0.grid(row=5, column=2)\nbtn_plus = tk.Button(root, text=\"+\", command=lambda: add_to_calculation(\"+\"), width=5, font=(\"Arial\", 14))\nbtn_plus.grid(row=2, column=4)\nbtn_minus = tk.Button(root, text=\"-\", command=lambda: add_to_calculation(\"-\"), width=5, font=(\"Arial\", 14))\nbtn_minus.grid(row=3, column=4)\nbtn_mul = tk.Button(root, text=\"*\", command=lambda: add_to_calculation(\"*\"), width=5, font=(\"Arial\", 14))\nbtn_mul.grid(row=4, column=4)\nbtn_div = tk.Button(root, text=\"\/\", command=lambda: add_to_calculation(\"\/\"), width=5, font=(\"Arial\", 14))\nbtn_div.grid(row=5, column=4)\nbtn_open = tk.Button(root, text=\"(\", command=lambda: add_to_calculation(\"(\"), width=5, font=(\"Arial\", 14))\nbtn_open.grid(row=5, column=1)\nbtn_close = tk.Button(root, text=\")\", command=lambda: add_to_calculation(\")\"), width=5, font=(\"Arial\", 14))\nbtn_close.grid(row=5, column=3)\nbtn_clear = tk.Button(root, text=\"C\", command=clear_field, width=11, font=(\"Arial\", 14))\nbtn_clear.grid(row=6, column=1, columnspan=2)\nbtn_equals = tk.Button(root, text=\"=\", command=evaluate_calculation, width=11, font=(\"Arial\", 14))\nbtn_equals.grid(row=6, column=3, columnspan=2)\n<\/code><\/pre>\n\n\n\n<p>This is what the buttons look like:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"281\" height=\"298\" src=\"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-content\/uploads\/2025\/12\/image-4.png\" alt=\"\" class=\"wp-image-86\" style=\"aspect-ratio:0.9429640287769784;width:225px;height:auto\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Today in class I made a GUI calculator. This is the code for the buttons on the calculator: This is what the buttons look like:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-81","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/posts\/81","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/comments?post=81"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/posts\/81\/revisions"}],"predecessor-version":[{"id":90,"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/posts\/81\/revisions\/90"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/media?parent=81"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/categories?post=81"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_harkless\/wp-json\/wp\/v2\/tags?post=81"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}