<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Tkinter on Mr. Pointing</title>
    <link>https://mrpointing.com/notes/computer-science/python/tkinter/</link>
    <description>Recent content in Tkinter on Mr. Pointing</description>
    <generator>Hugo</generator>
    <language>en</language>
    <copyright>&lt;a href=&#34;https://creativecommons.org/licenses/by-nc/4.0/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;CC BY-NC 4.0&lt;/a&gt;</copyright>
    <lastBuildDate>Sun, 09 Mar 2025 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://mrpointing.com/notes/computer-science/python/tkinter/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Geometry Managers</title>
      <link>https://mrpointing.com/notes/computer-science/python/tkinter/geometry-managers/</link>
      <pubDate>Sun, 09 Mar 2025 00:00:00 +0000</pubDate>
      <guid>https://mrpointing.com/notes/computer-science/python/tkinter/geometry-managers/</guid>
      <description>&lt;hr&gt;&#xA;&lt;h1 id=&#34;controlling-layouts-with-geometry-managers&#34;&gt;Controlling Layouts with Geometry Managers&lt;/h1&gt;&#xA;&lt;p&gt;Tkinter has three &lt;em&gt;geometry managers&lt;/em&gt;, or methods that define how the content of your app is structured. &lt;code&gt;.pack()&lt;/code&gt; is just one of them; we also could use &lt;code&gt;.place()&lt;/code&gt; or &lt;code&gt;.grid()&lt;/code&gt;. You can only use one at a time, so let&amp;rsquo;s discover the instances in which we&amp;rsquo;d use them.&lt;/p&gt;&#xA;&lt;h2 id=&#34;pack&#34;&gt;&lt;code&gt;.pack()&lt;/code&gt;&lt;/h2&gt;&#xA;&lt;p&gt;When using &lt;code&gt;.pack()&lt;/code&gt;, you&amp;rsquo;re actually using a &lt;em&gt;packing algorithm&lt;/em&gt; in order to place the widgets on screen. It accomplishes this in two steps;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Interactive Applications</title>
      <link>https://mrpointing.com/notes/computer-science/python/tkinter/interactive-applications/</link>
      <pubDate>Sun, 09 Mar 2025 00:00:00 +0000</pubDate>
      <guid>https://mrpointing.com/notes/computer-science/python/tkinter/interactive-applications/</guid>
      <description>&lt;hr&gt;&#xA;&lt;p&gt;The above has taught you how to make things appear inside your window. This will only get you so far; the things in your window need to do things. Let&amp;rsquo;s learn about &lt;em&gt;events&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;h1 id=&#34;using-events-and-event-handlers&#34;&gt;Using Events and Event Handlers&lt;/h1&gt;&#xA;&lt;p&gt;Going back to when we learned about the &lt;code&gt;window.mainloop()&lt;/code&gt;, the loop this starts is known as the &lt;em&gt;event loop&lt;/em&gt;. During this, the window will wait for some response. All we have to code is the events that we want to happen in response to these events, otherwise known as &lt;em&gt;event handlers&lt;/em&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Widgets</title>
      <link>https://mrpointing.com/notes/computer-science/python/tkinter/widgets/</link>
      <pubDate>Sun, 09 Mar 2025 00:00:00 +0000</pubDate>
      <guid>https://mrpointing.com/notes/computer-science/python/tkinter/widgets/</guid>
      <description>&lt;hr&gt;&#xA;&lt;p&gt;Below are a few different types of widgets;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;Label&lt;/code&gt;: displays text&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Button&lt;/code&gt;: displays a button that can have text and do action commands&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Entry&lt;/code&gt;: displays a text input form for a single line&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Text&lt;/code&gt;: displays a text input form for multi-line entry&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Frame&lt;/code&gt;: a rectangular area for widgets or padding between widgets&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;There are many more widgets, as well as &lt;em&gt;themed widgets&lt;/em&gt;, which are more updated versions of classic widgets, but we don&amp;rsquo;t need to get into that today.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Your First App</title>
      <link>https://mrpointing.com/notes/computer-science/python/tkinter/your-first-app/</link>
      <pubDate>Sun, 27 Oct 2024 00:00:00 +0000</pubDate>
      <guid>https://mrpointing.com/notes/computer-science/python/tkinter/your-first-app/</guid>
      <description>&lt;hr&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://realpython.com/python-gui-tkinter/&#34;&gt;Link&lt;/a&gt; to the tutorial.&lt;/p&gt;&#xA;&lt;p&gt;What makes Tkinter nice is that it&amp;rsquo;s a built-in library, meaning it should come with all versions of Python 3.12. If you&amp;rsquo;re using Ubuntu (like me) for this example you will have to install it but it doesn&amp;rsquo;t take long at all (&lt;code&gt;sudo apt-get install python3-tk&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Creating your first window is incredibly simple. The following code will get you up and running in no time:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; tkinter &lt;span style=&#34;color:#66d9ef&#34;&gt;as&lt;/span&gt; tk&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;window &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; tk&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;Tk()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;words &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; tk&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;Label(text&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;I Love Python!&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;words&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;pack()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; __name__ &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;__main__&amp;#34;&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;window&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;mainloop()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The above code will give you an empty window that will stay open until you close it.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
