{"id":1383,"date":"2018-11-04T18:27:50","date_gmt":"2018-11-04T17:27:50","guid":{"rendered":"http:\/\/pythonprogramming.altervista.org\/?p=1383"},"modified":"2019-03-24T16:33:03","modified_gmt":"2019-03-24T15:33:03","slug":"a-simple-calculator-with-tkinter","status":"publish","type":"post","link":"https:\/\/pythonprogramming.altervista.org\/a-simple-calculator-with-tkinter\/","title":{"rendered":"Mini &#8211; calculator with Python and tkinter"},"content":{"rendered":"<h1>Calculator&#8230; not just like you imagine it<\/h1>\n<p><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2018\/11\/minicalculator.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1521\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2018\/11\/minicalculator.png\" alt=\"\" width=\"497\" height=\"316\" srcset=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2018\/11\/minicalculator.png 497w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2018\/11\/minicalculator-320x203.png 320w\" sizes=\"auto, (max-width: 497px) 100vw, 497px\" \/><\/a><\/p>\n<p>I want to show a simple use of tkinter, very simple, but with a practical example that can be useful for many simple tasks, that you can make more complex for your purposes.<\/p>\n<h2>The code for the calculator<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"\" src=\"https:\/\/image.flaticon.com\/icons\/svg\/1186\/1186292.svg\" alt=\"Gears free icon\" width=\"422\" height=\"422\" \/><\/p>\n<p>Here is the code, no buttons as you can use the keyboard to do all the things you need.<\/p>\n<pre class=\"lang:default decode:true\">from tkinter import *\r\n\r\n#This function returns a Frame\r\ndef iCalc(source, side):\r\n    \"Returns a Frame object yet packed and expanded, to shorten the code\"\r\n    # the bd is the border of the frame\r\n    storeObj = Frame(source, borderwidth=10, bd=1, bg=\"gray\")\r\n    # the pack methos is needed to diplay the object\r\n    storeObj.pack(side=side, expand=YES, fill=BOTH)\r\n    return storeObj\r\n\r\n# This class inherit from Frame\r\nclass App(Frame):\r\n    def __init__(self):\r\n        Frame.__init__(self)\r\n        self.option_add(\"*Font\", \"arial 20 bold\")\r\n        self.pack(expand=YES, fill=BOTH)\r\n        self.master.title(\"MiniCalculator\")\r\n\r\n\r\n        #  THE DISPLAY\r\n        display = StringVar()\r\n        # relief can be FLAT or RIDGE or RAISED or SUNKEN GROOVE\r\n        entry = Entry(self, relief=FLAT, textvariable=display, justify='right', bd=15, bg='orange')\r\n        entry.pack(side=TOP)\r\n        # I added an action to calculate the operation when Return (Enter) is hit\r\n        entry.focus()\r\n        # You can hit enter to get the result instead of clicking =\r\n        self.master.bind(\"&lt;Return&gt;\", lambda e, s=self, storeObj=display: s.calc(storeObj))\r\n        # YOu can click del button on the keyboard to cancel\r\n        self.master.bind(\"&lt;Delete&gt;\", lambda e, s=self, storeObj=display: storeObj.set(\"\"))\r\n        self.master.bind(\"&lt;BackSpace&gt;\", lambda e, s=self, storeObj=display: storeObj.set(\"\"))\r\n\r\n\r\n\r\n    def calc(self, display):\r\n        try:\r\n        \t# Sets the display to the evaluation of the string in the display itself, i.e. calculate the result\r\n            display.set(eval(display.get()))\r\n        except:\r\n        \t# if something goes wrong with the result\r\n            display.set(\"ERROR\")\r\n\r\n\r\nif __name__ == '__main__':\r\n    App().mainloop()\r\n<\/pre>\n<p>Make an exe from the script minicalculator<\/p>\n<p>Read <a href=\"https:\/\/pythonprogramming.altervista.org\/create-an-exe-with-pyinstaller\/\">this article<\/a> to know how to do it, or write this on cmd, after you installed pyinstaller with<\/p>\n<blockquote><p><strong>pip install pyinstaller<\/strong><\/p><\/blockquote>\n<pre class=\"lang:default decode:true \">pyinstaller --noconsole --onefile --noupx minicalculator.py<\/pre>\n<p>You will find the <strong>exe<\/strong> file in the &#8216;<strong>dist<\/strong>&#8216; folder that will appear in the folder of the .py file.<\/p>\n<p>If you double click on the <strong>exe<\/strong> file and it <strong>does not run<\/strong>, open the <strong>cmd<\/strong>\u00a0in that folder and write<\/p>\n<pre class=\"lang:default decode:true\">.\\minicalculator<\/pre>\n<p>You can also try this: right click on the exe file and choose &#8216;<strong>run as administrator<\/strong>&#8216;. The next time you will not need to do this, you can just double click on it.<\/p>\n<p><iframe loading=\"lazy\" width=\"100%\" height=\"400px\" src=\"https:\/\/repl.it\/@EducationalChan\/Minicalculator?lite=true\" scrolling=\"no\" frameborder=\"no\" allowtransparency=\"true\" allowfullscreen=\"allowfullscreen\" sandbox=\"allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals\"><\/iframe><\/p>\n<h4>Utilities<\/h4>\r\n<a href=\"https:\/\/pythonprogramming.altervista.org\/mind-map-with-python\/\">\r\n<img decoding=\"async\" src=\"https:\/\/i1.wp.com\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/12\/PYDOT.png?resize=321%2C229&ssl=1\"><\/a>\r\n<script>\r\nvar title = \"Utility\";\r\nvar links = [Mak\r\n\t\t\t e\r\n\t[\"https:\/\/pythonprogramming.altervista.org\/create-exe-from-python-script-with-images-with-pyinstaller\/\",\"Make Exe cointaining Images\"],\r\n\t[\"https:\/\/pythonprogramming.altervista.org\/send-email-to-different-people-with-python\/\",\"Send More Email at the same time\"],\r\n\t[\"https:\/\/pythonprogramming.altervista.org\/convert-some-data-into-another-format\/\",\"Convert data separation type into another\"],\r\n\t[\"https:\/\/pythonprogramming.altervista.org\/use-sublime-integrated-with-github\/\",\"Github + Sublime text 3\"],\r\n\t[\"https:\/\/pythonprogramming.altervista.org\/make-html-tables-with-pandas\/\",\"Excel to Html Table with Pandas\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/create-a-beautiful-html-table-with-python\/\",\"Beautiful Html Table made with Python\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/split-images-with-pil-aka-pillow-and-python-for-sprite-animation\/\",\"Crop images\"],\r\n\t[\"https:\/\/pythonprogramming.altervista.org\/sublime-text-snippets-how-to-use-them\/\",\"Snippets in Sublime Text\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/create-a-presentation-html-page-with-all-the-images-in-a-folder-in-a-second\/\",\"Create Html page with images using Python in seconds\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/mind-map-with-python\/\",\"Mind Maps & Python (Pydot)\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pixelize-an-image-with-pil-and-python\/\",\"Pixelize images\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/tkinter-to-make-pdf-fast-and-free-with-text-or-html\/\",\"Create PDF with Tkinter\"],\r\n[\"\",\"Python Lauches a file in Chrome 2\"],\r\n [\"https:\/\/pythonprogramming.altervista.org\/create-an-html-page-and-launch-it-with-cefpython3-in-chrome\/\",\r\n  \"Python launches a local file in Chrome 2\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/python-to-powerpoint-2-0\/\",\"Python vs Powerpoint v.2\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/what-if-you-got-dns_probe_finished_nxdomain-with-glitch-me-sites\/\",\"Cannot open a site (dns solution)\"],\r\n['https:\/\/pythonprogramming.altervista.org\/convert-text-to-html-docx-and-pdf\/', 'Covert txt to html, docx and pdf'],\r\n['https:\/\/pythonprogramming.altervista.org\/capture-screenshot-with-python-and-lackey\/', 'Capture screenshot'],\r\n['https:\/\/pythonprogramming.altervista.org\/check-if-a-directory-exists-with-python\/', 'Check if a directory exists'],\r\n['https:\/\/pythonprogramming.altervista.org\/how-to-copy-all-the-files-in-a-directory\/', 'Copy all files in a folder'],\r\n['https:\/\/pythonprogramming.altervista.org\/put-some-order-in-my-files-with-python-with-filecollector\/', 'Copy many file on pc in one folder'],\r\n['https:\/\/pythonprogramming.altervista.org\/creare-una-tabella-con-python\/', 'Creare tabelle html con python'],\r\n['https:\/\/pythonprogramming.altervista.org\/make-an-image-with-text-with-python\/', 'Create an image with text'],\r\n['https:\/\/pythonprogramming.altervista.org\/create-an-exe-with-pyinstaller\/', 'Exe from .py (pyinstaller)'],\r\n['https:\/\/pythonprogramming.altervista.org\/create-a-test-in-html-from-a-txt-file\/', 'Format test in html from txt file'],\r\n['https:\/\/pythonprogramming.altervista.org\/freezing-dependencies-hell-on-python-2018\/', 'Freeze dependencies'],\r\n['https:\/\/pythonprogramming.altervista.org\/google-text-to-speech-example-of-gui-to-create-mp3-from-text\/', 'GUI to create MP3 (gtts)'],\r\n['https:\/\/pythonprogramming.altervista.org\/git-basic-commands-to-keep-track-of-your-project\/', 'Git and Github'],\r\n['https:\/\/pythonprogramming.altervista.org\/grab-a-web-page-without-strange-characters\/', 'Grab a web page without strange characters'],\r\n['https:\/\/pythonprogramming.altervista.org\/grab-the-text-from-a-word-document\/', 'Grab text from Word documents'],\r\n['https:\/\/pythonprogramming.altervista.org\/grab-data-text-from-the-web-with-python-and-urllib\/', 'Grab web text'],\r\n['https:\/\/pythonprogramming.altervista.org\/1563-2\/', 'Html Tables with Python'],\r\n['https:\/\/pythonprogramming.altervista.org\/join-all-images-vertically-or-horizontally\/', 'Join Images'],\r\n['https:\/\/pythonprogramming.altervista.org\/repl-with-sublime-keybinding-to-use-python-interactively\/', 'Keybind Sublime'],\r\n['https:\/\/pythonprogramming.altervista.org\/how-to-get-all-the-file-in-a-directory\/', 'List all files in the directory'],\r\n['https:\/\/pythonprogramming.altervista.org\/all-the-files-in-your-hard-drive-with-os-walk\/', \"List all hard drive's files\"],\r\n['https:\/\/pythonprogramming.altervista.org\/transform-a-png-in-a-thumbnail\/', 'Make a thumbnail (PIL)'],\r\n['https:\/\/pythonprogramming.altervista.org\/a-simple-calculator-with-tkinter\/', 'Mini-Calculator'],\r\n['https:\/\/pythonprogramming.altervista.org\/how-to-merge-all-pdf-files-present-in-a-folder\/', 'Pdf merger'],\r\n['https:\/\/pythonprogramming.altervista.org\/tkinter-a-program-start-mp4-with-ffplay\/', 'Play video with ffplay \/ os'],\r\n['https:\/\/pythonprogramming.altervista.org\/png-to-gif\/', 'Png to Gif (PIL)'],\r\n['https:\/\/pythonprogramming.altervista.org\/using-the-re-module-to-grab-numbers-in-a-text-and-make-different-tests-with-few-code\/', 'Practical example with Regex'],\r\n['https:\/\/pythonprogramming.altervista.org\/python-to-make-svg-easier-for-html-pages\/', 'Python and SVG'],\r\n['https:\/\/pythonprogramming.altervista.org\/make-python-use-your-modules\/', 'Python modules finder'],\r\n['https:\/\/pythonprogramming.altervista.org\/how-to-read-and-write-files-in-python\/', 'Read and write files'],\r\n['https:\/\/pythonprogramming.altervista.org\/rename-all-files-in-a-directory-with-python\/', 'Rename all files'],\r\n['https:\/\/pythonprogramming.altervista.org\/find-all-the-files-on-your-computer\/', 'Search all files of a type'],\r\n['https:\/\/pythonprogramming.altervista.org\/split-square-images-into-many-images-with-python-and-image_slicer\/', 'Split images'],\r\n['https:\/\/pythonprogramming.altervista.org\/split-an-image-and-rename-the-output-images\/', 'Split images'],\r\n['https:\/\/pythonprogramming.altervista.org\/python-inserting-subtitles-to-youtube-videos-on-your-wordpress-site\/', 'Subtitles for Youtube'],\r\n['https:\/\/pythonprogramming.altervista.org\/from-text-to-mp3-with-gtts-reading-external-file\/', 'Text to Mp3 (gtts)'],\r\n['https:\/\/pythonprogramming.altervista.org\/if-you-get-an-error-using-gtts-module\/', 'The gtts error'],\r\n['https:\/\/pythonprogramming.altervista.org\/create-a-true-false-test-with-random-order-of-sentences-with-python\/', 'True false test with Python'],\r\n['https:\/\/pythonprogramming.altervista.org\/unzip-and-unrar-to-extract-zipped-files-with-python-and-7zip\/', 'Unzip and Unrar'],\r\n['https:\/\/pythonprogramming.altervista.org\/use-your-own-module-on-python\/', 'Use your own modules'],\r\n['https:\/\/pythonprogramming.altervista.org\/download-a-video-from-youtube\/', 'Youtube video download']\r\n\t\t];\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>\r\n\r\n\n\t<!----- pubblicit\u00e0-------- vedi h:\\ads\\codice_di_prima.txt per il codice che era qui --------------------->\r\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- Altervista-pythonprogramming-336X280 -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-4189782812829764\"\r\n     data-ad-slot=\"2548661001\"\r\n     data-ad-format=\"auto\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\r\n<h4>Tkinter test for students<\/h4>\r\n\r\n\r\n<script>\r\nvar title = \"Tkinter posts\";\r\n\t\tvar links = [\r\n[\"https:\/\/pythonprogramming.altervista.org\/tkinter-app-to-make-a-different-test-for-every-student-part-1\/\",\"Tk Test Marker I\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/tkinter-testmaker-part-ii\/\",\"Tk Test Maker II\"],\t\r\n[\"https:\/\/pythonprogramming.altervista.org\/tkinter-tests-app-part-3\/\",\"Tk test Maker III\"]\r\n];\r\n\t\t\r\n\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\t\r\n\r\n<h4>Tkinter articles<\/h4>\r\n<!-- calculator with memo -->\r\n<a href=\"https:\/\/pythonprogramming.altervista.org\/free-calculator-memo-with-tkinter-support-markdown-to-html-saving-too\/\">\r\n<img decoding=\"async\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/03\/calcmemopy_banner.png\" width=\"100%\"><\/a>\r\n<script>\r\nvar title = \"Tkinter posts\";\r\n\t\tvar links = [\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/?p=5719&preview=true\",\"Presentation app with SVG files\"],\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/png-joined-in-one-pdf-files\/\",\"Join png into pdf\"],\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/free-app-imgslide-3-1-slide-images-and-join-them-into-a-pdf\/\",\"ImageSlider 3.1\"],\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/tkinter-to-show-svg-files-svgslider-1-0\/\",\"SVGSlider 1.0\"],\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/imageslider-3-0-tkinter-app-to-show-images-like-in-a-presentation\/\",\"ImageSlider 3.0\"],\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/tkinter-shows-an-svg-file\/\",\"SVG in tkinter\"],\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/tkinter-tests-maker-app-part-iv-add-a-menu-with-tkinter\/\",\"Add a menu with tkinter\"],\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/free-pdf-maker-app-with-python\/\",\"tkinter make pdf\"],\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/calcpy-2-0-the-second-and-final-part-of-calculator\/\",\"Live coding Calculator app part 2\"],\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/split-every-page-in-a-pdf-i-a-different-pdf\/\",\"Split a pdf in different files\"],\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/python-calculator-from-skratch-part-1-calcpy\/\",\"Calculator from skratch p.1\"], \r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/python-and-tkinter-fully-working-listbox-to-do-app-for-skratch\/\",\"Tkinter ToDo App\"],\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/copy-and-paste-tkinter-widget-code-app\/\",\"Copy and paste app for tkinter widgets\"],\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/calcdoc-py-a-tkinter-app-to-memorize-operations\/\",\"calcdoc.py: a great calculator memo app\"],\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/tkinter-calculator-with-memo-of-operations\/\",\"Calculator + list of operations\"],\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/tkinter-smallest-calculator-ever\/\", \"Smallest calculator\"],\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/python-gui-with-tkinter-labels-with-text-and-images\/\",\"Labels with images and text\"],\r\n\t[\"https:\/\/pythonprogramming.altervista.org\/a-toolbar-for-python-with-tkinter\/\",\"Toolbar in tkinter\"],\r\n\t[\"https:\/\/pythonprogramming.altervista.org\/tkinter-grid-system-how-to-expand-a-button\/\",\"Fit Buttons to the Window\"],\r\n\t\t[\"https:\/\/pythonprogramming.altervista.org\/tkinter-application-launcher-python-gui\/\",\"Tkinter app Laucher\"],\r\n\t\t[\"https:\/\/pythonprogramming.altervista.org\/tkinter-and-how-to-add-an-image-to-a-button\/\", \"Image on a tkinter Button\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/tkinter-imagebrowser-2-with-canvas\/\", \"Tkinter image browser 2 (canvas)\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/tkinter-image-broswer\/\",\"Tkinter image browser (label)\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/tkinter-to-make-pdf-fast-and-free-with-text-or-html\/\",\"Create PDF with Tkinter Text widget\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/tkinter-app-to-evaluate-tests-part-1\/\",\"Tkinter App to Evaluate tests\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/simple-presentation-in-pure-python-while-you-learn-tkinter\/\",\"Presentation with Python\/tkinter\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/tkinter-entry-widgets-example-make-a-shuffler-app\/\",\"Tkinter example: entry to shuffle lists\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/move-a-rectangle-with-text-inside-of-it-with-tkinter\/\",\"Moving a text with tkinter\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/tkinter-and-ttk-the-option-menu-widget\/\",\"Tkinter's OptionMenu (and ttk)\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/tkinter-app-to-watch-videos-with-live-coding\/\",\t\t\t\t\t\"Tkinter to watch videos\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/type-reader-app-in-python-pc-read-the-letters-you-type-tkinter\/\",\t\"Type Reader App\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/create-a-new-tkinter-widget-inputbox\/\",\t\t\t\t\t\t\t\"Create your Inputbox\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/tkinter-open-a-new-window-and-just-one\/\", \t\t\t\t\t\t\"Open only one more window\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/a-simple-test-maker-with-python-and-tkinter\/\", \t\t\t\t\t\"Test maker with tkinter\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/my-personal-notepad-toggle-tkinter-fullscreen\/\",\t\t\t\t\t\"Ebook maker with tkinter\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/tkinter-and-listbox-1\/\", \t\t\t\t\t\t\t\t\t\t\t\"Tkinter & listbox 2019 - 1\"],\r\n['https:\/\/pythonprogramming.altervista.org\/tkinter-using-a-gui-graphic-user-interface-with-python-part-1\/', \t'Create a window'],\r\n['https:\/\/pythonprogramming.altervista.org\/tkinter-to-make-a-window-video-1\/', \t\t\t\t\t\t\t\t'Create a window part 2'],\r\n[\"https:\/\/pythonprogramming.altervista.org\/create-more-windows-with-tkinter\/\",\t\t\t\t\t\t\t\t\"More windows tkinter!\"],\r\n['https:\/\/pythonprogramming.altervista.org\/tkinter-part-2-binding\/', \t\t\t\t\t\t\t\t\t\t'Binding functions to key\/button '],\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/all-tkinter-posts\/\",\">>>ALL TKINTER POSTS>>>\"]\r\n\t\t];\r\n\t\t\r\n\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>\n","protected":false},"excerpt":{"rendered":"How to create the tiniest calculator ever.\n<a class=\"moretag\" href=\"https:\/\/pythonprogramming.altervista.org\/a-simple-calculator-with-tkinter\/\"> [...]<\/a>","protected":false},"author":1,"featured_media":1521,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1,49,178],"tags":[128,177,51],"class_list":["post-1383","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-examples","category-tkinter","category-utility","tag-calculator","tag-examples","tag-tkinter"],"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\/1383","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=1383"}],"version-history":[{"count":11,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/1383\/revisions"}],"predecessor-version":[{"id":1754,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/1383\/revisions\/1754"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/media\/1521"}],"wp:attachment":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/media?parent=1383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/categories?post=1383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/tags?post=1383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}