{"id":935,"date":"2022-09-20T15:26:23","date_gmt":"2022-07-19T06:26:36","guid":{"rendered":"https:\/\/www.silicloud.com\/blog\/uncategorized\/using-classes-in-tkinter-advanced-techniques\/"},"modified":"2024-03-18T15:23:05","modified_gmt":"2024-03-18T15:23:05","slug":"using-classes-in-tkinter-advanced-techniques","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/","title":{"rendered":"Using Classes in Tkinter Advanced Techniques"},"content":{"rendered":"<p>In today&#8217;s session, we will focus on classes in Tkinter. If you have prior experience with Tkinter, you are likely aware of the extensive range of GUI features available for application development.<\/p>\n<p>However, when developing applications, you soon realize that the module has additional complexities beyond what is immediately apparent.<\/p>\n<p>In tkinter, there are numerous concealed features, and among them is the inclusion of the class functionality within the module.<\/p>\n<h2>Configuring the Tkinter Module<\/h2>\n<p>You don&#8217;t have to install any module because the tkinter module is included in the standard<a href=\"https:\/\/docs.python.org\/3\/library\/index.html\"> Python library.<\/a><\/p>\n<p>However, this article will focus on a more advanced version of the tkinter module, so it is suggested that you review the beginner series first.<\/p>\n<p>Before you proceed, make sure you take the time to familiarize yourself with the fundamental tutorials on TKinter available here.<\/p>\n<ul class=\"post-ul\">\n<li>Tkinter Part &#8211; 1<\/li>\n<li>Tkinter Part &#8211; 2<\/li>\n<li>Tkinter Part &#8211; 3<\/li>\n<\/ul>\n<p>If you have finished the fundamental tutorials, let&#8217;s start delving into using the tkinter module.<\/p>\n<p>To utilize classes, we must import the tkinter module.<\/p>\n<pre class=\"post-pre\"><code><span class=\"token comment\"># Importing the tkinter module<\/span>\r\n<span class=\"token keyword\">import<\/span> tkinter <span class=\"token keyword\">as<\/span> tk\r\n\r\n<span class=\"token comment\"># Used for styling the GUI<\/span>\r\n<span class=\"token keyword\">from<\/span> tkinter <span class=\"token keyword\">import<\/span> tkk\r\n<\/code><\/pre>\n<p>To make things more convenient, we will import the ttk package individually.<\/p>\n<h2>How to use Classes in Tkinter.<\/h2>\n<p>We will now learn how to use classes in Tkinter. The functioning of the application is quite straightforward.<\/p>\n<p>To start, we establish a main window, where we position a sole frame on its top layer.<\/p>\n<p>To create the illusion of an application having multiple windows, we will additionally develop a function that transitions between various frames.<\/p>\n<p>The user is made to believe that they are being directed to a separate window or tab, but in reality, they are just switching between frames.<\/p>\n<p>The MainPage, SidePage, and CompletionScreen are the Frames that we&#8217;ll be dealing with.<\/p>\n<p>The way we will switch between them is by utilizing the show_frame() method.<\/p>\n<h2>Coding is being worked on.<\/h2>\n<p>To begin with, we should establish a fundamental class that will serve as our gateway to access all the remaining classes\/frames.<\/p>\n<pre class=\"post-pre\"><code><span class=\"token comment\"># Allowing us to extend from the Tk class<\/span>\r\n<span class=\"token keyword\">class<\/span> <span class=\"token class-name\">testClass<\/span><span class=\"token punctuation\">(<\/span>tk<span class=\"token punctuation\">.<\/span>Tk<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span>\r\n<\/code><\/pre>\n<p>By inheriting the tk.Tk class, we gain the ability to interact with elements that exist in the Tk() class.<\/p>\n<h3>1. Starting up the classes<\/h3>\n<p>To begin the class, we utilize the __init__ function which generates a method that automatically executes when we create an object from the class.<\/p>\n<p>Likewise, we are also initializing the class via the tk.Tk __init__ method.<\/p>\n<pre class=\"post-pre\"><code><span class=\"token keyword\">import<\/span> tkinter <span class=\"token keyword\">as<\/span> tk\r\n<span class=\"token keyword\">from<\/span> tkinter <span class=\"token keyword\">import<\/span> ttk\r\n\r\n<span class=\"token keyword\">class<\/span> <span class=\"token class-name\">windows<\/span><span class=\"token punctuation\">(<\/span>tk<span class=\"token punctuation\">.<\/span>Tk<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span>\r\n    <span class=\"token keyword\">def<\/span> <span class=\"token function\">__init__<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> <span class=\"token operator\">*<\/span>args<span class=\"token punctuation\">,<\/span> <span class=\"token operator\">**<\/span>kwargs<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span>\r\n        tk<span class=\"token punctuation\">.<\/span>Tk<span class=\"token punctuation\">.<\/span>__init__<span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> <span class=\"token operator\">*<\/span>args<span class=\"token punctuation\">,<\/span> <span class=\"token operator\">**<\/span>kwargs<span class=\"token punctuation\">)<\/span>\r\n        <span class=\"token comment\"># Adding a title to the window<\/span>\r\n        self<span class=\"token punctuation\">.<\/span>wm_title<span class=\"token punctuation\">(<\/span><span class=\"token string\">\"Test Application\"<\/span><span class=\"token punctuation\">)<\/span>\r\n\r\n        <span class=\"token comment\"># creating a frame and assigning it to container<\/span>\r\n        container <span class=\"token operator\">=<\/span> tk<span class=\"token punctuation\">.<\/span>Frame<span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> height<span class=\"token operator\">=<\/span><span class=\"token number\">400<\/span><span class=\"token punctuation\">,<\/span> width<span class=\"token operator\">=<\/span><span class=\"token number\">600<\/span><span class=\"token punctuation\">)<\/span>\r\n        <span class=\"token comment\"># specifying the region where the frame is packed in root<\/span>\r\n        container<span class=\"token punctuation\">.<\/span>pack<span class=\"token punctuation\">(<\/span>side<span class=\"token operator\">=<\/span><span class=\"token string\">\"top\"<\/span><span class=\"token punctuation\">,<\/span> fill<span class=\"token operator\">=<\/span><span class=\"token string\">\"both\"<\/span><span class=\"token punctuation\">,<\/span> expand<span class=\"token operator\">=<\/span><span class=\"token boolean\">True<\/span><span class=\"token punctuation\">)<\/span>\r\n\r\n        <span class=\"token comment\"># configuring the location of the container using grid<\/span>\r\n        container<span class=\"token punctuation\">.<\/span>grid_rowconfigure<span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span> weight<span class=\"token operator\">=<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span>\r\n        container<span class=\"token punctuation\">.<\/span>grid_columnconfigure<span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span> weight<span class=\"token operator\">=<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span>\r\n\r\n        <span class=\"token comment\"># We will now create a dictionary of frames<\/span>\r\n        self<span class=\"token punctuation\">.<\/span>frames <span class=\"token operator\">=<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token punctuation\">}<\/span>\r\n        <span class=\"token comment\"># we'll create the frames themselves later but let's add the components to the dictionary.<\/span>\r\n        <span class=\"token keyword\">for<\/span> F <span class=\"token keyword\">in<\/span> <span class=\"token punctuation\">(<\/span>MainPage<span class=\"token punctuation\">,<\/span> SidePage<span class=\"token punctuation\">,<\/span> CompletionScreen<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span>\r\n            frame <span class=\"token operator\">=<\/span> F<span class=\"token punctuation\">(<\/span>container<span class=\"token punctuation\">,<\/span> self<span class=\"token punctuation\">)<\/span>\r\n\r\n            <span class=\"token comment\"># the windows class acts as the root window for the frames.<\/span>\r\n            self<span class=\"token punctuation\">.<\/span>frames<span class=\"token punctuation\">[<\/span>F<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">=<\/span> frame\r\n            frame<span class=\"token punctuation\">.<\/span>grid<span class=\"token punctuation\">(<\/span>row<span class=\"token operator\">=<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span> column<span class=\"token operator\">=<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span> sticky<span class=\"token operator\">=<\/span><span class=\"token string\">\"nsew\"<\/span><span class=\"token punctuation\">)<\/span>\r\n\r\n        <span class=\"token comment\"># Using a method to switch frames<\/span>\r\n        self<span class=\"token punctuation\">.<\/span>show_frame<span class=\"token punctuation\">(<\/span>MainPage<span class=\"token punctuation\">)<\/span>\r\n\r\n<\/code><\/pre>\n<h3>2. Developing a Technique for Changing View Frames<\/h3>\n<p>Once the __init__ is set up and the Frames are selected, we can proceed with developing a function to change the frame being viewed.<\/p>\n<pre class=\"post-pre\"><code>    <span class=\"token keyword\">def<\/span> <span class=\"token function\">show_frame<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> cont<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span>\r\n        frame <span class=\"token operator\">=<\/span> self<span class=\"token punctuation\">.<\/span>frames<span class=\"token punctuation\">[<\/span>cont<span class=\"token punctuation\">]<\/span>\r\n        <span class=\"token comment\"># raises the current frame to the top<\/span>\r\n        frame<span class=\"token punctuation\">.<\/span>tkraise<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span>\r\n<\/code><\/pre>\n<h3>3. Developing multiple classifications for frames.<\/h3>\n<p>Currently, we generate a variety of classes that function as Frames, and these Frames are swapped using the show_frame() method.<\/p>\n<pre class=\"post-pre\"><code><span class=\"token keyword\">class<\/span> <span class=\"token class-name\">MainPage<\/span><span class=\"token punctuation\">(<\/span>tk<span class=\"token punctuation\">.<\/span>Frame<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span>\r\n    <span class=\"token keyword\">def<\/span> <span class=\"token function\">__init__<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> parent<span class=\"token punctuation\">,<\/span> controller<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span>\r\n        tk<span class=\"token punctuation\">.<\/span>Frame<span class=\"token punctuation\">.<\/span>__init__<span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> parent<span class=\"token punctuation\">)<\/span>\r\n        label <span class=\"token operator\">=<\/span> tk<span class=\"token punctuation\">.<\/span>Label<span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> text<span class=\"token operator\">=<\/span><span class=\"token string\">\"Main Page\"<\/span><span class=\"token punctuation\">)<\/span>\r\n        label<span class=\"token punctuation\">.<\/span>pack<span class=\"token punctuation\">(<\/span>padx<span class=\"token operator\">=<\/span><span class=\"token number\">10<\/span><span class=\"token punctuation\">,<\/span> pady<span class=\"token operator\">=<\/span><span class=\"token number\">10<\/span><span class=\"token punctuation\">)<\/span>\r\n\r\n        <span class=\"token comment\"># We use the switch_window_button in order to call the show_frame() method as a lambda function<\/span>\r\n        switch_window_button <span class=\"token operator\">=<\/span> tk<span class=\"token punctuation\">.<\/span>Button<span class=\"token punctuation\">(<\/span>\r\n            self<span class=\"token punctuation\">,<\/span>\r\n            text<span class=\"token operator\">=<\/span><span class=\"token string\">\"Go to the Side Page\"<\/span><span class=\"token punctuation\">,<\/span>\r\n            command<span class=\"token operator\">=<\/span><span class=\"token keyword\">lambda<\/span><span class=\"token punctuation\">:<\/span> controller<span class=\"token punctuation\">.<\/span>show_frame<span class=\"token punctuation\">(<\/span>SidePage<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span>\r\n        <span class=\"token punctuation\">)<\/span>\r\n        switch_window_button<span class=\"token punctuation\">.<\/span>pack<span class=\"token punctuation\">(<\/span>side<span class=\"token operator\">=<\/span><span class=\"token string\">\"bottom\"<\/span><span class=\"token punctuation\">,<\/span> fill<span class=\"token operator\">=<\/span>tk<span class=\"token punctuation\">.<\/span>X<span class=\"token punctuation\">)<\/span>\r\n\r\n\r\n<span class=\"token keyword\">class<\/span> <span class=\"token class-name\">SidePage<\/span><span class=\"token punctuation\">(<\/span>tk<span class=\"token punctuation\">.<\/span>Frame<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span>\r\n    <span class=\"token keyword\">def<\/span> <span class=\"token function\">__init__<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> parent<span class=\"token punctuation\">,<\/span> controller<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span>\r\n        tk<span class=\"token punctuation\">.<\/span>Frame<span class=\"token punctuation\">.<\/span>__init__<span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> parent<span class=\"token punctuation\">)<\/span>\r\n        label <span class=\"token operator\">=<\/span> tk<span class=\"token punctuation\">.<\/span>Label<span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> text<span class=\"token operator\">=<\/span><span class=\"token string\">\"This is the Side Page\"<\/span><span class=\"token punctuation\">)<\/span>\r\n        label<span class=\"token punctuation\">.<\/span>pack<span class=\"token punctuation\">(<\/span>padx<span class=\"token operator\">=<\/span><span class=\"token number\">10<\/span><span class=\"token punctuation\">,<\/span> pady<span class=\"token operator\">=<\/span><span class=\"token number\">10<\/span><span class=\"token punctuation\">)<\/span>\r\n\r\n        switch_window_button <span class=\"token operator\">=<\/span> tk<span class=\"token punctuation\">.<\/span>Button<span class=\"token punctuation\">(<\/span>\r\n            self<span class=\"token punctuation\">,<\/span>\r\n            text<span class=\"token operator\">=<\/span><span class=\"token string\">\"Go to the Completion Screen\"<\/span><span class=\"token punctuation\">,<\/span>\r\n            command<span class=\"token operator\">=<\/span><span class=\"token keyword\">lambda<\/span><span class=\"token punctuation\">:<\/span> controller<span class=\"token punctuation\">.<\/span>show_frame<span class=\"token punctuation\">(<\/span>CompletionScreen<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span>\r\n        <span class=\"token punctuation\">)<\/span>\r\n        switch_window_button<span class=\"token punctuation\">.<\/span>pack<span class=\"token punctuation\">(<\/span>side<span class=\"token operator\">=<\/span><span class=\"token string\">\"bottom\"<\/span><span class=\"token punctuation\">,<\/span> fill<span class=\"token operator\">=<\/span>tk<span class=\"token punctuation\">.<\/span>X<span class=\"token punctuation\">)<\/span>\r\n\r\n\r\n<span class=\"token keyword\">class<\/span> <span class=\"token class-name\">CompletionScreen<\/span><span class=\"token punctuation\">(<\/span>tk<span class=\"token punctuation\">.<\/span>Frame<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span>\r\n    <span class=\"token keyword\">def<\/span> <span class=\"token function\">__init__<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> parent<span class=\"token punctuation\">,<\/span> controller<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span>\r\n        tk<span class=\"token punctuation\">.<\/span>Frame<span class=\"token punctuation\">.<\/span>__init__<span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> parent<span class=\"token punctuation\">)<\/span>\r\n        label <span class=\"token operator\">=<\/span> tk<span class=\"token punctuation\">.<\/span>Label<span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> text<span class=\"token operator\">=<\/span><span class=\"token string\">\"Completion Screen, we did it!\"<\/span><span class=\"token punctuation\">)<\/span>\r\n        label<span class=\"token punctuation\">.<\/span>pack<span class=\"token punctuation\">(<\/span>padx<span class=\"token operator\">=<\/span><span class=\"token number\">10<\/span><span class=\"token punctuation\">,<\/span> pady<span class=\"token operator\">=<\/span><span class=\"token number\">10<\/span><span class=\"token punctuation\">)<\/span>\r\n        switch_window_button <span class=\"token operator\">=<\/span> ttk<span class=\"token punctuation\">.<\/span>Button<span class=\"token punctuation\">(<\/span>\r\n            self<span class=\"token punctuation\">,<\/span> text<span class=\"token operator\">=<\/span><span class=\"token string\">\"Return to menu\"<\/span><span class=\"token punctuation\">,<\/span> command<span class=\"token operator\">=<\/span><span class=\"token keyword\">lambda<\/span><span class=\"token punctuation\">:<\/span> controller<span class=\"token punctuation\">.<\/span>show_frame<span class=\"token punctuation\">(<\/span>MainPage<span class=\"token punctuation\">)<\/span>\r\n        <span class=\"token punctuation\">)<\/span>\r\n        switch_window_button<span class=\"token punctuation\">.<\/span>pack<span class=\"token punctuation\">(<\/span>side<span class=\"token operator\">=<\/span><span class=\"token string\">\"bottom\"<\/span><span class=\"token punctuation\">,<\/span> fill<span class=\"token operator\">=<\/span>tk<span class=\"token punctuation\">.<\/span>X<span class=\"token punctuation\">)<\/span>\r\n<\/code><\/pre>\n<p>You might have observed that the self.frames variable is used to add these classes to the main class.<\/p>\n<p>While I will retain the instructions for implementing the classes under __name__==&#8221;main&#8221;, you also have the option to use them directly.<\/p>\n<pre class=\"post-pre\"><code><span class=\"token keyword\">if<\/span> __name__ <span class=\"token operator\">==<\/span> <span class=\"token string\">\"__main__\"<\/span><span class=\"token punctuation\">:<\/span>\r\n    testObj <span class=\"token operator\">=<\/span> windows<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span>\r\n    testObj<span class=\"token punctuation\">.<\/span>mainloop<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span>\r\n<\/code><\/pre>\n<h3>Advancing<\/h3>\n<p>Now that we have finished defining the classes and methods, we are ready to execute this script.<\/p>\n<p>You should see a small window that enables you to easily switch between frames by clicking on a button.<\/p>\n<p>At a higher level, you also have the capability to switch between frames within an application by using a menu bar located at the top.<\/p>\n<h2>In summary, to wrap it up&#8230;<\/h2>\n<p>When utilizing classes in the tkinter module, it allows for numerous possibilities and opportunities in developing and innovating applications.<\/p>\n<p>Today we have been busy with a lot of coding, and to make sure we&#8217;re all in agreement, here&#8217;s the main idea!<\/p>\n<p>If you want to see it in action, take a look at my project Eisen&#8217;s Tickets. It demonstrates various Tkinter features like classes and operates with SQLite3.<\/p>\n<h2>Can you provide me with a single alternative to paraphrase the word &#8220;References&#8221; natively?<\/h2>\n<ul class=\"post-ul\">\n<li>Tkinter Documentation<\/li>\n<li>Tkinter Classes<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>More tutorials<\/p>\n<p><a class=\"LinkSuggestion__Link-sc-1gewdgc-4 cLBplk\" href=\"https:\/\/www.silicloud.com\/blog\/how-to-utilize-sub-and-gsub-functions-in-r\/\" target=\"_blank\" rel=\"noopener\">How to utilize sub() and gsub() functions in R<span class=\"sc-gswNZR eASTkv\">(Opens in a new browser tab)<\/span><\/a><\/p>\n<p><a class=\"LinkSuggestion__Link-sc-1gewdgc-4 cLBplk\" href=\"https:\/\/www.silicloud.com\/blog\/init-or-swift-initialization-in-swift\/\" target=\"_blank\" rel=\"noopener\">init or Swift initialization in Swift<span class=\"sc-gswNZR eASTkv\">(Opens in a new browser tab)<\/span><\/a><\/p>\n<p><a class=\"LinkSuggestion__Link-sc-1gewdgc-4 cLBplk\" href=\"https:\/\/www.silicloud.com\/blog\/spring-mvc-controller\/\" target=\"_blank\" rel=\"noopener\">Spring MVC Controller<span class=\"sc-gswNZR eASTkv\">(Opens in a new browser tab)<\/span><\/a><\/p>\n<p><a class=\"LinkSuggestion__Link-sc-1gewdgc-4 cLBplk\" href=\"https:\/\/www.silicloud.com\/blog\/jquery-tree-traversal-functions\/\" target=\"_blank\" rel=\"noopener\">jQuery parent() and children() tree traversal functions<span class=\"sc-gswNZR eASTkv\">(Opens in a new browser tab)<\/span><\/a><\/p>\n<p><a class=\"LinkSuggestion__Link-sc-1gewdgc-4 cLBplk\" href=\"https:\/\/www.silicloud.com\/blog\/beginners-can-find-a-tutorial-on-java-web-applications\/\" target=\"_blank\" rel=\"noopener\">Beginners can find a tutorial on Java web applications.<span class=\"sc-gswNZR eASTkv\">(Opens in a new browser tab)<\/span><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In today&#8217;s session, we will focus on classes in Tkinter. If you have prior experience with Tkinter, you are likely aware of the extensive range of GUI features available for application development. However, when developing applications, you soon realize that the module has additional complexities beyond what is immediately apparent. In tkinter, there are numerous [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-935","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using Classes in Tkinter Advanced Techniques - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"we will focus on classes in Tkinter. If you have prior experience with Tkinter, you are likely aware of the extensive range of GUI features\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Classes in Tkinter Advanced Techniques\" \/>\n<meta property=\"og:description\" content=\"we will focus on classes in Tkinter. If you have prior experience with Tkinter, you are likely aware of the extensive range of GUI features\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/SiliCloudGlobal\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-19T06:26:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-18T15:23:05+00:00\" \/>\n<meta name=\"author\" content=\"William Carter\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@SiliCloudGlobal\" \/>\n<meta name=\"twitter:site\" content=\"@SiliCloudGlobal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"William Carter\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/\"},\"author\":{\"name\":\"William Carter\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/f697031891aacefc4b681d139781d3c0\"},\"headline\":\"Using Classes in Tkinter Advanced Techniques\",\"datePublished\":\"2022-07-19T06:26:36+00:00\",\"dateModified\":\"2024-03-18T15:23:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/\"},\"wordCount\":717,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\"},\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/\",\"url\":\"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/\",\"name\":\"Using Classes in Tkinter Advanced Techniques - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#website\"},\"datePublished\":\"2022-07-19T06:26:36+00:00\",\"dateModified\":\"2024-03-18T15:23:05+00:00\",\"description\":\"we will focus on classes in Tkinter. If you have prior experience with Tkinter, you are likely aware of the extensive range of GUI features\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.silicloud.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using Classes in Tkinter Advanced Techniques\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/blog\/\",\"name\":\"Silicon Cloud Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\",\"name\":\"Silicon Cloud Blog\",\"url\":\"https:\/\/www.silicloud.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png\",\"contentUrl\":\"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png\",\"width\":1024,\"height\":1024,\"caption\":\"Silicon Cloud Blog\"},\"image\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/SiliCloudGlobal\/\",\"https:\/\/twitter.com\/SiliCloudGlobal\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/f697031891aacefc4b681d139781d3c0\",\"name\":\"William Carter\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1786698071dd8d74bec894b512f9e3c610c3a2a32985f67e688976cee3c8bbef?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1786698071dd8d74bec894b512f9e3c610c3a2a32985f67e688976cee3c8bbef?s=96&d=mm&r=g\",\"caption\":\"William Carter\"},\"url\":\"https:\/\/www.silicloud.com\/blog\/author\/williamcarter\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Using Classes in Tkinter Advanced Techniques - Blog - Silicon Cloud","description":"we will focus on classes in Tkinter. If you have prior experience with Tkinter, you are likely aware of the extensive range of GUI features","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/","og_locale":"en_US","og_type":"article","og_title":"Using Classes in Tkinter Advanced Techniques","og_description":"we will focus on classes in Tkinter. If you have prior experience with Tkinter, you are likely aware of the extensive range of GUI features","og_url":"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/","og_site_name":"Blog - Silicon Cloud","article_publisher":"https:\/\/www.facebook.com\/SiliCloudGlobal\/","article_published_time":"2022-07-19T06:26:36+00:00","article_modified_time":"2024-03-18T15:23:05+00:00","author":"William Carter","twitter_card":"summary_large_image","twitter_creator":"@SiliCloudGlobal","twitter_site":"@SiliCloudGlobal","twitter_misc":{"Written by":"William Carter","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/#article","isPartOf":{"@id":"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/"},"author":{"name":"William Carter","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/f697031891aacefc4b681d139781d3c0"},"headline":"Using Classes in Tkinter Advanced Techniques","datePublished":"2022-07-19T06:26:36+00:00","dateModified":"2024-03-18T15:23:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/"},"wordCount":717,"commentCount":0,"publisher":{"@id":"https:\/\/www.silicloud.com\/blog\/#organization"},"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/","url":"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/","name":"Using Classes in Tkinter Advanced Techniques - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/blog\/#website"},"datePublished":"2022-07-19T06:26:36+00:00","dateModified":"2024-03-18T15:23:05+00:00","description":"we will focus on classes in Tkinter. If you have prior experience with Tkinter, you are likely aware of the extensive range of GUI features","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/blog\/using-classes-in-tkinter-advanced-techniques\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.silicloud.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Using Classes in Tkinter Advanced Techniques"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/blog\/#website","url":"https:\/\/www.silicloud.com\/blog\/","name":"Silicon Cloud Blog","description":"","publisher":{"@id":"https:\/\/www.silicloud.com\/blog\/#organization"},"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.silicloud.com\/blog\/#organization","name":"Silicon Cloud Blog","url":"https:\/\/www.silicloud.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png","contentUrl":"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png","width":1024,"height":1024,"caption":"Silicon Cloud Blog"},"image":{"@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/SiliCloudGlobal\/","https:\/\/twitter.com\/SiliCloudGlobal"]},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/f697031891aacefc4b681d139781d3c0","name":"William Carter","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1786698071dd8d74bec894b512f9e3c610c3a2a32985f67e688976cee3c8bbef?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1786698071dd8d74bec894b512f9e3c610c3a2a32985f67e688976cee3c8bbef?s=96&d=mm&r=g","caption":"William Carter"},"url":"https:\/\/www.silicloud.com\/blog\/author\/williamcarter\/"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/935","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/comments?post=935"}],"version-history":[{"count":0,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/935\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/media?parent=935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/categories?post=935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/tags?post=935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}