{"id":2166,"date":"2021-01-11T03:00:40","date_gmt":"2021-01-11T03:00:40","guid":{"rendered":"https:\/\/www.pythontutorial.net\/?page_id=2166"},"modified":"2025-04-01T09:06:44","modified_gmt":"2025-04-01T09:06:44","slug":"tkinter-stringvar","status":"publish","type":"page","link":"https:\/\/www.pythontutorial.net\/tkinter\/tkinter-stringvar\/","title":{"rendered":"Tkinter StringVar"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn about the Tkinter <code>StringVar<\/code> object and how to use it to manipulate values of widgets.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='introduction-to-the-tkinter-stringvar'>Introduction to the Tkinter StringVar <a href=\"#introduction-to-the-tkinter-stringvar\" class=\"anchor\" id=\"introduction-to-the-tkinter-stringvar\" title=\"Anchor for Introduction to the Tkinter StringVar\">#<\/a><\/h2>\n\n\n\n<p>The Tkinter <code>StringVar<\/code> helps you manage the value of a widget such as a <code><a href=\"https:\/\/www.pythontutorial.net\/tkinter\/tkinter-label\/\">Label<\/a><\/code> or <code><a href=\"https:\/\/www.pythontutorial.net\/tkinter\/tkinter-entry\/\">Entry<\/a><\/code> more effectively.<\/p>\n\n\n\n<p>To create a new <code>StringVar<\/code> object, you use the <code>StringVar<\/code> constructor like this:<\/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\">string_var = tk.StringVar(master, value, name)<\/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>StringVar<\/code> constructor accepts three optional arguments:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>master<\/code> is a widget that the <code>StringVar<\/code> object associated with. If you skip the <code>master<\/code>, it defaults to the main window.<\/li>\n\n\n\n<li><code>value<\/code> is the initial value that defaults to an empty string <code>''<\/code>.<\/li>\n\n\n\n<li><code>name<\/code> is a Tcl name that defaults to <code>PY_VARnum<\/code> where num is 1, 2, 3, etc., for example <code>PY_VAR1<\/code>, <code>PY_VAR2<\/code>.<\/li>\n<\/ul>\n\n\n\n<p>After creating the <code>StringVar<\/code> object, you can assign it to the <code>textvariable<\/code> of a widget that accepts a <code>StringVar<\/code> object. For example, the following assigns the <code>string_var<\/code> to <code>textvariable<\/code> of the <code>Entry<\/code> widget:<\/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\">entry = ttk.Entry(master, textvariable=string_var)<\/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>To get the current value of the <code>Entry<\/code> widget, you can use the <code>get()<\/code> method of the <code>StringVar<\/code> object:<\/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\">string_var.get()<\/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>The <code>StringVar<\/code> object will notify you whenever its value changes. This feature is useful if you want to automatically update other widgets based on the current value of the <code>StringVar<\/code> object.<\/p>\n\n\n\n<p>To invoke a callback whenever the value of an <code>StringVar<\/code> object changes, you use the <code>trace_add()<\/code> method of the <code>StringVar<\/code> object:<\/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\">string_var.trace_add(mode, callback)<\/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>The <code>trace_add<\/code> method defines a trace callback for the StringVar. It accepts two variables:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>mode<\/code> determines when the StringVar should call the callback. The mode can be a string &#8216;write&#8217;, &#8216;read&#8217;, or &#8216;unset&#8217;, or a tuple of these strings. For example, if you set the mode to &#8216;write, the StringVar will call the callback whenever its values changes.<\/li>\n\n\n\n<li><code>callback<\/code> is the function that the StringVar will call according to the <code>mode<\/code>.<\/li>\n<\/ul>\n\n\n\n<p>If you don&#8217;t want to trace the value of a StringVar object, you can use the trace_remove() method:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">string_var<\/span><span class=\"hljs-selector-class\">.trace_remove<\/span>(<span class=\"hljs-selector-tag\">mode<\/span>, <span class=\"hljs-selector-tag\">callback<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>trace_remove()<\/code> method has two parameters mode and callback that has the same meaning as the ones in the <code>trace_add()<\/code> method.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='tkinter-stringvar-example'>Tkinter StringVar example <a href=\"#tkinter-stringvar-example\" class=\"anchor\" id=\"tkinter-stringvar-example\" title=\"Anchor for Tkinter StringVar example\">#<\/a><\/h2>\n\n\n\n<p>The following example illustrates how to link the <code>StringVar<\/code> object with an <code>Entry<\/code> widget:<\/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\"><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\n\nroot = tk.Tk()\nroot.title(<span class=\"hljs-string\">'Tkinter StringVar'<\/span>)\nroot.geometry(<span class=\"hljs-string\">\"250x100\"<\/span>)\n\npack_attr = {<span class=\"hljs-string\">'anchor'<\/span>: tk.W, <span class=\"hljs-string\">'padx'<\/span>: <span class=\"hljs-number\">5<\/span>, <span class=\"hljs-string\">'pady'<\/span>: <span class=\"hljs-number\">5<\/span>, <span class=\"hljs-string\">'fill'<\/span>: tk.X}\n\nttk.Label(root, text=<span class=\"hljs-string\">'Name'<\/span>).pack(**pack_attr)\n\n<span class=\"hljs-comment\"># Entry<\/span>\nname_var = tk.StringVar()\nname_entry = ttk.Entry(root, textvariable=name_var)\nname_entry.pack(**pack_attr)\nname_entry.focus()\n\n\noutput_label = ttk.Label(root, textvariable=name_var)\noutput_label.pack(**pack_attr)\n\nroot.mainloop()<\/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>Output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"372\" height=\"211\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2025\/04\/Tkinter-StringVar-Demo.gif\" alt=\"Tkinter StringVar Demo\" class=\"wp-image-7352\"\/><\/figure>\n\n\n\n<p>How it works.<\/p>\n\n\n\n<p>First, create a new <code>StringVar<\/code> object:<\/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\">name_var = tk.StringVar()<\/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>Second, link the <code>StringVar<\/code> object with an <code>Entry<\/code> widget:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">name_entry = ttk.Entry(frame, textvariable=name_var)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><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>Third, link the same StringVar object with a <code>Label<\/code> widget:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">output_label = ttk.Label(output_frame, textvariable=name_var)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><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<h2 class=\"wp-block-heading\" id='tracing-text-changes-example'>Tracing text changes example <a href=\"#tracing-text-changes-example\" class=\"anchor\" id=\"tracing-text-changes-example\" title=\"Anchor for Tracing text changes example\">#<\/a><\/h2>\n\n\n\n<p>The following example illustrates how to use the <code>StringVar<\/code> object to trace text changes.<\/p>\n\n\n\n<p>The root window has two <code>Entry<\/code> widgets: <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>password <\/li>\n\n\n\n<li>password confirmation<\/li>\n<\/ul>\n\n\n\n<p>If you confirm the wrong password, the program shows an error message. Otherwise, it&#8217;ll show a success message:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" 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\n\nroot = tk.Tk()\nroot.title(<span class=\"hljs-string\">'Change Password'<\/span>)\nroot.geometry(<span class=\"hljs-string\">\"300x200\"<\/span>)\n\nERROR = <span class=\"hljs-string\">'Error.TLabel'<\/span>\nWARNING = <span class=\"hljs-string\">'Warning.TLabel'<\/span>\nSUCCESS = <span class=\"hljs-string\">'Success.TLabel'<\/span>\n\nstyle = ttk.Style(root)\nstyle.configure(<span class=\"hljs-string\">'Error.TLabel'<\/span>, foreground=<span class=\"hljs-string\">'red'<\/span>)\nstyle.configure(<span class=\"hljs-string\">'Success.TLabel'<\/span>, foreground=<span class=\"hljs-string\">'green'<\/span>)\nstyle.configure(<span class=\"hljs-string\">'Warning.TLabel'<\/span>, foreground=<span class=\"hljs-string\">'orange'<\/span>)\n\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">validate_password<\/span><span class=\"hljs-params\">(*args)<\/span>:<\/span>\n    password = password_var.get()\n    confirm_password = password_confirmation_var.get()\n\n    <span class=\"hljs-keyword\">if<\/span> <span class=\"hljs-keyword\">not<\/span> password <span class=\"hljs-keyword\">or<\/span> <span class=\"hljs-keyword\">not<\/span> confirm_password:\n        set_message(<span class=\"hljs-string\">\"\"<\/span>, WARNING)\n        <span class=\"hljs-keyword\">return<\/span>\n\n\n    <span class=\"hljs-keyword\">if<\/span> confirm_password == password:\n        set_message(\n            <span class=\"hljs-string\">\"The passwords match!\"<\/span>, SUCCESS)\n        <span class=\"hljs-keyword\">return<\/span>\n\n    <span class=\"hljs-keyword\">if<\/span> password.startswith(confirm_password):\n        set_message(<span class=\"hljs-string\">'The passwords are partially matching!'<\/span>, WARNING)\n        <span class=\"hljs-keyword\">return<\/span>\n\n\n    set_message(<span class=\"hljs-string\">\"The passwords don't match!\"<\/span>, ERROR)\n\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">set_message<\/span><span class=\"hljs-params\">( message, message_type=None)<\/span>:<\/span>\n    output_label&#91;<span class=\"hljs-string\">'text'<\/span>] = message\n    <span class=\"hljs-keyword\">if<\/span> message_type <span class=\"hljs-keyword\">is<\/span> <span class=\"hljs-keyword\">not<\/span> <span class=\"hljs-literal\">None<\/span>:\n        output_label&#91;<span class=\"hljs-string\">'style'<\/span>] = message_type\n\n\npack_attr = {<span class=\"hljs-string\">'anchor'<\/span>: tk.W, <span class=\"hljs-string\">'padx'<\/span>: <span class=\"hljs-number\">5<\/span>, <span class=\"hljs-string\">'pady'<\/span>: <span class=\"hljs-number\">5<\/span>, <span class=\"hljs-string\">'fill'<\/span>: tk.X}\n\noutput_label = ttk.Label(root, text=<span class=\"hljs-string\">''<\/span>)\noutput_label.pack(**pack_attr)\n\n\n<span class=\"hljs-comment\"># password field<\/span>\nttk.Label(root, text=<span class=\"hljs-string\">'New Password:'<\/span>).pack(**pack_attr)\npassword_var = tk.StringVar()\npassword = ttk.Entry(root, textvariable=password_var, show=<span class=\"hljs-string\">'*'<\/span>)\npassword.pack(**pack_attr)\npassword.focus()\n\n\n<span class=\"hljs-comment\"># password confirmation field<\/span>\nttk.Label(root, text=<span class=\"hljs-string\">'Password Confirmation:'<\/span>).pack(**pack_attr)\npassword_confirmation_var = tk.StringVar()\npassword_confirmation = ttk.Entry(root, textvariable=password_confirmation_var, show=<span class=\"hljs-string\">'*'<\/span>)\npassword_confirmation.pack(**pack_attr)\n\npassword_confirmation_var.trace_add(<span class=\"hljs-string\">'write'<\/span>, validate_password)\n\n\n<span class=\"hljs-comment\"># button<\/span>\nbutton = ttk.Button(\n    root, \n    text=<span class=\"hljs-string\">'Change Password'<\/span>\n    \n)\nbutton.pack(anchor=tk.W, padx=<span class=\"hljs-number\">5<\/span>, pady=<span class=\"hljs-number\">5<\/span>)\n\n\nroot.mainloop()<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><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-full\"><img loading=\"lazy\" decoding=\"async\" width=\"445\" height=\"276\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2025\/04\/Tkinter-StringVar-Tracing-Text.gif\" alt=\"Tkinter StringVar Tracing Text\" class=\"wp-image-7353\"\/><\/figure>\n\n\n\n<p>How it works:<\/p>\n\n\n\n<p>First, define two constants <code>ERROR<\/code> and <code>SUCCESS<\/code> that will be set to the <code>message_label<\/code> based on the result of the validation:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">ERROR = <span class=\"hljs-string\">'Error.TLabel'<\/span>\nSUCCESS = <span class=\"hljs-string\">'Success.TLabel'<\/span>\nWARNING = <span class=\"hljs-string\">'Warning.TLabel'<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><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>Second, create two <code>StringVar<\/code> objects:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">password_var = tk.StringVar()\npassword_confirmation_var = tk.StringVar()<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><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>Third, use the <code>trace_add()<\/code> method to call the <code>validate()<\/code> function whenever the text of the password confirmation widget changes:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\">password_confirmation_var.trace_add(<span class=\"hljs-string\">'write'<\/span>, validate_password)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><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>Finally, show the success message if the passwords match in the <code>validate()<\/code> method. Otherwise, show a warning message if the password starts with the confirmed password. If the passwords don&#8217;t match, show an error message.<\/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\">\n<li>Use Tkinter <code>StringVar<\/code> object to track and change the string state of a widget.<\/li>\n<\/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=\"2166\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/tkinter\/tkinter-stringvar\/\"\n\t\t\t\tdata-post-title=\"Tkinter StringVar\"\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=\"2166\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/tkinter\/tkinter-stringvar\/\"\n\t\t\t\tdata-post-title=\"Tkinter StringVar\"\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>Summary: in this tutorial, you&#8217;ll learn about the Tkinter StringVar object and how to use it to manipulate values of widgets. Introduction to the Tkinter StringVar # The Tkinter StringVar helps you manage the value of a widget such as a Label or Entry more effectively. To create a new StringVar object, you use the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1232,"menu_order":48,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2166","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/2166","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=2166"}],"version-history":[{"count":5,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/2166\/revisions"}],"predecessor-version":[{"id":7354,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/2166\/revisions\/7354"}],"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=2166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}