{"id":1734,"date":"2020-12-21T02:24:10","date_gmt":"2020-12-21T02:24:10","guid":{"rendered":"https:\/\/www.pythontutorial.net\/?page_id=1734"},"modified":"2022-05-13T01:08:19","modified_gmt":"2022-05-13T01:08:19","slug":"tkinter-after","status":"publish","type":"page","link":"https:\/\/www.pythontutorial.net\/tkinter\/tkinter-after\/","title":{"rendered":"How to Schedule an Action with Tkinter after() method"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn how to use the Tkinter <code>after()<\/code> method to schedule an action after a timeout has elapsed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-tkinter-after-method'>Introduction to Tkinter after() method <a href=\"#introduction-to-tkinter-after-method\" class=\"anchor\" id=\"introduction-to-tkinter-after-method\" title=\"Anchor for Introduction to Tkinter &lt;code&gt;after()&lt;\/code&gt; method\">#<\/a><\/h2>\n\n\n\n<p>All Tkinter widgets have the <code>after()<\/code> method with the following syntax:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">widget.after(delay, callback=<span class=\"hljs-literal\">None<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>after()<\/code> method calls the <code>callback<\/code> function once after a <code>delay<\/code> milliseconds (ms) within Tkinter&#8217;s main loop.<\/p>\n\n\n\n<p>If you don&#8217;t provide the <code>callback<\/code>, the <code>after()<\/code> method behaves like the <code>time.sleep()<\/code> function. However, the <code>after()<\/code> method uses the millisecond instead of the second as the unit.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='tkinter-after-method-example'>Tkinter after() method example <a href=\"#tkinter-after-method-example\" class=\"anchor\" id=\"tkinter-after-method-example\" title=\"Anchor for Tkinter after() method example\">#<\/a><\/h2>\n\n\n\n<p>Let&#8217;s see the following program:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">import<\/span> tkinter <span class=\"hljs-keyword\">as<\/span> tk\n<span class=\"hljs-keyword\">from<\/span> tkinter <span class=\"hljs-keyword\">import<\/span> ttk\n<span class=\"hljs-keyword\">import<\/span> time\n\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">App<\/span><span class=\"hljs-params\">(tk.Tk)<\/span>:<\/span>\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">__init__<\/span><span class=\"hljs-params\">(self)<\/span>:<\/span>\n        super().__init__()\n\n        self.title(<span class=\"hljs-string\">'Tkinter after() Demo'<\/span>)\n        self.geometry(<span class=\"hljs-string\">'300x100'<\/span>)\n\n        self.style = ttk.Style(self)\n\n        self.button = ttk.Button(self, text=<span class=\"hljs-string\">'Wait 3 seconds'<\/span>)\n        self.button&#91;<span class=\"hljs-string\">'command'<\/span>] = self.start\n        self.button.pack(expand=<span class=\"hljs-literal\">True<\/span>, ipadx=<span class=\"hljs-number\">10<\/span>, ipady=<span class=\"hljs-number\">5<\/span>)\n\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">start<\/span><span class=\"hljs-params\">(self)<\/span>:<\/span>\n        self.change_button_color(<span class=\"hljs-string\">'red'<\/span>)\n        time.sleep(<span class=\"hljs-number\">3<\/span>)\n        self.change_button_color(<span class=\"hljs-string\">'black'<\/span>)\n\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">change_button_color<\/span><span class=\"hljs-params\">(self, color)<\/span>:<\/span>\n        self.style.configure(<span class=\"hljs-string\">'TButton'<\/span>, foreground=color)\n\n\n<span class=\"hljs-keyword\">if<\/span> __name__ == <span class=\"hljs-string\">\"__main__\"<\/span>:\n    app = App()\n    app.mainloop()<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The program consists of a button. When you click the button:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>First, the color of the button turns red.<\/li><li>Then, the program sleeps for 3 seconds.<\/li><li>Finally, the color of the button turns black.<\/li><\/ul>\n\n\n\n<p>However, when you run the program and click the button, you&#8217;ll notice that the color of the button doesn&#8217;t change at all. Also, the window freezes for 3 seconds like this:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"302\" height=\"132\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/12\/Tkinter-after-sleep.png\" alt=\"\" class=\"wp-image-1740\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/12\/Tkinter-after-sleep.png 302w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/12\/Tkinter-after-sleep-300x131.png 300w\" sizes=\"auto, (max-width: 302px) 100vw, 302px\" \/><\/figure><\/div>\n\n\n\n<p>The reason was that the <code>sleep()<\/code> function suspended the main thread execution. Therefore, Tkinter couldn&#8217;t update the GUI.<\/p>\n\n\n\n<p>To fix the issue, you can use the <code>after()<\/code> method to schedule the action that updates the color of the button instead of suspending the main thread execution. For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">import<\/span> tkinter <span class=\"hljs-keyword\">as<\/span> tk\r\n<span class=\"hljs-keyword\">from<\/span> tkinter <span class=\"hljs-keyword\">import<\/span> ttk\r\n<span class=\"hljs-keyword\">import<\/span> time\r\n\r\n\r\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">App<\/span><span class=\"hljs-params\">(tk.Tk)<\/span>:<\/span>\r\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">__init__<\/span><span class=\"hljs-params\">(self)<\/span>:<\/span>\r\n        super().__init__()\r\n\r\n        self.title(<span class=\"hljs-string\">'Tkinter after() Demo'<\/span>)\r\n        self.geometry(<span class=\"hljs-string\">'300x100'<\/span>)\r\n\r\n        self.style = ttk.Style(self)\r\n\r\n        self.button = ttk.Button(self, text=<span class=\"hljs-string\">'Wait 3 seconds'<\/span>)\r\n        self.button&#91;<span class=\"hljs-string\">'command'<\/span>] = self.start\r\n        self.button.pack(expand=<span class=\"hljs-literal\">True<\/span>, ipadx=<span class=\"hljs-number\">10<\/span>, ipady=<span class=\"hljs-number\">5<\/span>)\r\n\r\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">start<\/span><span class=\"hljs-params\">(self)<\/span>:<\/span>\r\n        self.change_button_color(<span class=\"hljs-string\">'red'<\/span>)\r\n        self.after(<span class=\"hljs-number\">3000<\/span>,<span class=\"hljs-keyword\">lambda<\/span>: self.change_button_color(<span class=\"hljs-string\">'black'<\/span>))\r\n\r\n\r\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">change_button_color<\/span><span class=\"hljs-params\">(self, color)<\/span>:<\/span>\r\n        self.style.configure(<span class=\"hljs-string\">'TButton'<\/span>, foreground=color)\r\n        print(color)\r\n\r\n\r\n<span class=\"hljs-keyword\">if<\/span> __name__ == <span class=\"hljs-string\">\"__main__\"<\/span>:\r\n    app = App()\r\n    app.mainloop()<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"302\" height=\"132\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/12\/Tkinter-after-example.png\" alt=\"\" class=\"wp-image-1741\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/12\/Tkinter-after-example.png 302w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/12\/Tkinter-after-example-300x131.png 300w\" sizes=\"auto, (max-width: 302px) 100vw, 302px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id='why-use-tkinter-after-method'>Why use Tkinter after() method <a href=\"#why-use-tkinter-after-method\" class=\"anchor\" id=\"why-use-tkinter-after-method\" title=\"Anchor for Why use Tkinter after() method\">#<\/a><\/h2>\n\n\n\n<p>A Python program can have <a href=\"https:\/\/www.pythontutorial.net\/advanced-python\/python-threading\/\">one or multiple threads<\/a>. When you launch a Tkinter application, it executes in the main thread.<\/p>\n\n\n\n<p>The Tkinter&#8217;s main loop must start from the main thread. It&#8217;s responsible for handling events and updating GUI.<\/p>\n\n\n\n<p>If you start a long-running task in the main thread, the GUI will freeze and don&#8217;t respond to user events.<\/p>\n\n\n\n<p>To prevent a long-running task from blocking the main thread, you can schedule an action that won&#8217;t be executed earlier than a specified time by using the <code>after()<\/code> method.<\/p>\n\n\n\n<p>Tkinter will execute the callback in the main thread when the main thread is <strong>not busy<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='a-practical-tkinter-after-method-example'>A practical Tkinter after() method example <a href=\"#a-practical-tkinter-after-method-example\" class=\"anchor\" id=\"a-practical-tkinter-after-method-example\" title=\"Anchor for A practical Tkinter after() method example\">#<\/a><\/h2>\n\n\n\n<p>The following program displays a digital clock. It uses the <code>after()<\/code> method to update the current time every second:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">import<\/span> tkinter <span class=\"hljs-keyword\">as<\/span> tk\n<span class=\"hljs-keyword\">from<\/span> tkinter <span class=\"hljs-keyword\">import<\/span> ttk\n<span class=\"hljs-keyword\">import<\/span> time\n\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">DigitalClock<\/span><span class=\"hljs-params\">(tk.Tk)<\/span>:<\/span>\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">__init__<\/span><span class=\"hljs-params\">(self)<\/span>:<\/span>\n        super().__init__()\n\n        <span class=\"hljs-comment\"># configure the root window<\/span>\n        self.title(<span class=\"hljs-string\">'Digital Clock'<\/span>)\n        self.resizable(<span class=\"hljs-number\">0<\/span>, <span class=\"hljs-number\">0<\/span>)\n        self.geometry(<span class=\"hljs-string\">'250x80'<\/span>)\n        self&#91;<span class=\"hljs-string\">'bg'<\/span>] = <span class=\"hljs-string\">'black'<\/span>\n\n        <span class=\"hljs-comment\"># change the background color to black<\/span>\n        self.style = ttk.Style(self)\n        self.style.configure(\n            <span class=\"hljs-string\">'TLabel'<\/span>,\n            background=<span class=\"hljs-string\">'black'<\/span>,\n            foreground=<span class=\"hljs-string\">'red'<\/span>)\n\n        <span class=\"hljs-comment\"># label<\/span>\n        self.label = ttk.Label(\n            self,\n            text=self.time_string(),\n            font=(<span class=\"hljs-string\">'Digital-7'<\/span>, <span class=\"hljs-number\">40<\/span>))\n\n        self.label.pack(expand=<span class=\"hljs-literal\">True<\/span>)\n\n        <span class=\"hljs-comment\"># schedule an update every 1 second<\/span>\n        self.label.after(<span class=\"hljs-number\">1000<\/span>, self.update)\n\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">time_string<\/span><span class=\"hljs-params\">(self)<\/span>:<\/span>\n        <span class=\"hljs-keyword\">return<\/span> time.strftime(<span class=\"hljs-string\">'%H:%M:%S'<\/span>)\n\n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">update<\/span><span class=\"hljs-params\">(self)<\/span>:<\/span>\n        <span class=\"hljs-string\">\"\"\" update the label every 1 second \"\"\"<\/span>\n\n        self.label.configure(text=self.time_string())\n\n        <span class=\"hljs-comment\"># schedule another timer<\/span>\n        self.label.after(<span class=\"hljs-number\">1000<\/span>, self.update)\n\n\n<span class=\"hljs-keyword\">if<\/span> __name__ == <span class=\"hljs-string\">\"__main__\"<\/span>:\n    clock = DigitalClock()\n    clock.mainloop()\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"252\" height=\"112\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2020\/12\/Tkinter-after-Digital-Clock.png\" alt=\"\" class=\"wp-image-1739\"\/><\/figure><\/div>\n\n\n\n<p>How it works.<\/p>\n\n\n\n<p>The following method returns the current time in the string format:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span>\u00a0<span class=\"hljs-title\">time_string<\/span><span class=\"hljs-params\">(self)<\/span>:<\/span>\n\u00a0\u00a0\u00a0\u00a0<span class=\"hljs-keyword\">return<\/span>\u00a0time.strftime(<span class=\"hljs-string\">'%H:%M:%S'<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>__init__()<\/code> method uses the <code>after()<\/code> method to schedule an action that updates the current time to the label every second:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">self.label.after(<span class=\"hljs-number\">1000<\/span>, self.update)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In the <code>update()<\/code> method, update the current time to the label, and schedule another update after one second:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span>\u00a0<span class=\"hljs-title\">update<\/span><span class=\"hljs-params\">(self)<\/span>:<\/span>\n\u00a0\u00a0\u00a0\u00a0<span class=\"hljs-string\">\"\"\"\u00a0update\u00a0the\u00a0label\u00a0every\u00a01\u00a0second\u00a0\"\"\"<\/span>\n\n\u00a0\u00a0\u00a0\u00a0self.label.configure(text=self.time_string())\n\n\u00a0\u00a0\u00a0\u00a0<span class=\"hljs-comment\">#\u00a0schedule\u00a0another\u00a0timer<\/span>\n\u00a0\u00a0\u00a0\u00a0self.label.after(<span class=\"hljs-number\">1000<\/span>,\u00a0self.update)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"note\">Note that this program uses the <a href=\"https:\/\/www.1001fonts.com\/digital-7-font.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Digital 7 font from the 1001fonts.com<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Use the Tkinter <code>after()<\/code> method to schedule an action that will run after a timeout has elapsed<\/li><li>The callback passed into the <code>after()<\/code> method still runs in the main thread. Therefore, you should avoid performing the long-running task using the <code>after()<\/code> method.<\/li><\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"1734\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/tkinter\/tkinter-after\/\"\n\t\t\t\tdata-post-title=\"How to Schedule an Action with Tkinter after() method\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"1734\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/tkinter\/tkinter-after\/\"\n\t\t\t\tdata-post-title=\"How to Schedule an Action with Tkinter after() method\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\t\t\t<input type=\"button\" name=\"wth-submit\" class=\"wth-btn wth-btn-submit\" id=\"wth-submit\" \/>\n\t\t\t<input type=\"button\" class=\"wth-btn wth-btn-cancel\" value=\"Cancel\" \/>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you&#8217;ll learn how to use the tkinter after() method to schedule an action after a timeout has elapsed.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1232,"menu_order":54,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1734","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/1734","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/comments?post=1734"}],"version-history":[{"count":0,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/1734\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/1232"}],"wp:attachment":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/media?parent=1734"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}