{"id":320,"date":"2022-10-17T12:59:34","date_gmt":"2022-10-17T04:59:34","guid":{"rendered":"https:\/\/islandtropicaman.com\/wp\/?p=320"},"modified":"2022-10-17T13:01:00","modified_gmt":"2022-10-17T05:01:00","slug":"tkinter-and-wxpython-tutorial-create-a-simple-tkinter-and-wxpython-gui","status":"publish","type":"post","link":"https:\/\/islandtropicaman.com\/wp\/2022\/10\/17\/tkinter-and-wxpython-tutorial-create-a-simple-tkinter-and-wxpython-gui\/","title":{"rendered":"Tkinter and wxPython tutorial &#8212; Create a simple Tkinter and wxPython GUI"},"content":{"rendered":"<p>Tkinter and wxPythn are two of the most famous Python GUIs that have been used by the worldwide python developers to create GUIs for their python applications!<\/p>\n<p>This first chapter of the Tkinter and wxPython tutorial will create two simple GUIs for both the Tkinter and wxPython as the starting point for me to write the tutorials about this particular Python GUI topic.<\/p>\n<p>Tkinter is shipped together with Python 3 thus it is included within the Python 3 package but wxPython is a separate third-party python library that you will need to install separately.<\/p>\n<p>You can use the pip command to install wxPython if you are a windows user, as for other OS users such as the Linux and Mac users please search for the online document on how to install the wxPython module on your computer which runs on the Mac and the Linux OS.<\/p>\n<p>Now let me create two simple programs to demonstrate to you the outcome of both GUIs.<\/p>\n<p>Tkinter: Create a simple Hello World GUI<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nimport tkinter as tk\r\n\r\nwin =  tk.Tk()\r\nwin.title(&quot;Hello World!&quot;)\r\nwin.mainloop()\r\n<\/pre>\n<p>As you can see the TK method of the Tkinter class will create the top level window object with &#8220;Hello World&#8221; as its title and then the program will enter the main loop where it will continue running until the user clicks on the &#8216;x&#8217; close button on the Tkinter&#8217;s window to terminate the Tkinter&#8217;s program. <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/islandtropicaman.com\/wp\/wp-content\/uploads\/2022\/10\/Tkinter.png\" alt=\"\" width=\"469\" height=\"336\" class=\"aligncenter size-full wp-image-321\" srcset=\"https:\/\/islandtropicaman.com\/wp\/wp-content\/uploads\/2022\/10\/Tkinter.png 469w, https:\/\/islandtropicaman.com\/wp\/wp-content\/uploads\/2022\/10\/Tkinter-300x215.png 300w\" sizes=\"auto, (max-width: 469px) 100vw, 469px\" \/><\/p>\n<p>wxPython: Create a simple Hello World GUI<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nimport wx\r\n\r\napp = wx.App(False)  \r\nframe = wx.Frame(None, wx.ID_ANY, &quot;Hello World&quot;) \r\nframe.Show(True)     \r\napp.MainLoop()\r\n<\/pre>\n<p>The above wxPython program will create a new wxPython application where the False&#8217;s parameter of the wx.App method simply asks the stdout\/stderr outcome to not get redirected to the top-level window object. The wx.Frame method will then create the top-level wxPython&#8217;s window object! At last that window object will get displayed\/started with the Show&#8217;s method. The program will enter the main loop and continue running until a user has clicked on the &#8216;x&#8217; button on the window object to close the program.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/islandtropicaman.com\/wp\/wp-content\/uploads\/2022\/10\/wxPython.png\" alt=\"\" width=\"487\" height=\"545\" class=\"aligncenter size-full wp-image-322\" srcset=\"https:\/\/islandtropicaman.com\/wp\/wp-content\/uploads\/2022\/10\/wxPython.png 487w, https:\/\/islandtropicaman.com\/wp\/wp-content\/uploads\/2022\/10\/wxPython-268x300.png 268w\" sizes=\"auto, (max-width: 487px) 100vw, 487px\" \/><\/p>\n<p>Thus which GUI do you prefer? Don&#8217;t make the decision yet until you have read the entire Tkinter and wxPython tutorial series in the next few chapters. <\/p>\n<p>If you want to learn more about Python and other programming languages don&#8217;t forget to subscribe to this blog so you will get notified whenever the latest article has been published.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tkinter and wxPythn are two of the most famous Python GUIs that have been used by the worldwide python developers to create GUIs for their python applications! This first chapter of the Tkinter and wxPython tutorial will create two simple GUIs for both the Tkinter and wxPython as the starting point for me to write&#8230;<\/p>\n<p class=\"more-link-wrap\"><a href=\"https:\/\/islandtropicaman.com\/wp\/2022\/10\/17\/tkinter-and-wxpython-tutorial-create-a-simple-tkinter-and-wxpython-gui\/\" class=\"more-link\">Read More<span class=\"screen-reader-text\"> &ldquo;Tkinter and wxPython tutorial &#8212; Create a simple Tkinter and wxPython GUI&rdquo;<\/span> &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,72],"tags":[10,95],"class_list":["post-320","post","type-post","status-publish","format-standard","hentry","category-python","category-python-tutorial","tag-tkinter","tag-wxpython"],"blog_post_layout_featured_media_urls":{"thumbnail":"","full":""},"categories_names":{"8":{"name":"Python","link":"https:\/\/islandtropicaman.com\/wp\/category\/python\/"},"72":{"name":"Python Tutorial","link":"https:\/\/islandtropicaman.com\/wp\/category\/python-tutorial\/"}},"tags_names":{"10":{"name":"tkinter","link":"https:\/\/islandtropicaman.com\/wp\/tag\/tkinter\/"},"95":{"name":"wxPython","link":"https:\/\/islandtropicaman.com\/wp\/tag\/wxpython\/"}},"comments_number":"0","_links":{"self":[{"href":"https:\/\/islandtropicaman.com\/wp\/wp-json\/wp\/v2\/posts\/320","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/islandtropicaman.com\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/islandtropicaman.com\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/islandtropicaman.com\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/islandtropicaman.com\/wp\/wp-json\/wp\/v2\/comments?post=320"}],"version-history":[{"count":2,"href":"https:\/\/islandtropicaman.com\/wp\/wp-json\/wp\/v2\/posts\/320\/revisions"}],"predecessor-version":[{"id":324,"href":"https:\/\/islandtropicaman.com\/wp\/wp-json\/wp\/v2\/posts\/320\/revisions\/324"}],"wp:attachment":[{"href":"https:\/\/islandtropicaman.com\/wp\/wp-json\/wp\/v2\/media?parent=320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/islandtropicaman.com\/wp\/wp-json\/wp\/v2\/categories?post=320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/islandtropicaman.com\/wp\/wp-json\/wp\/v2\/tags?post=320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}