<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Muhammad Osama on Medium]]></title>
        <description><![CDATA[Stories by Muhammad Osama on Medium]]></description>
        <link>https://medium.com/@mosama?source=rss-9362d70b924e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LbyNKLqqaDHJ7ST57MeTzA.jpeg</url>
            <title>Stories by Muhammad Osama on Medium</title>
            <link>https://medium.com/@mosama?source=rss-9362d70b924e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 20:06:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mosama/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Getting Started with Tkinter GUI Programming in Python]]></title>
            <link>https://medium.com/@mosama/getting-started-with-tkinter-gui-programming-in-python-ff28fe267566?source=rss-9362d70b924e------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff28fe267566</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[gui]]></category>
            <category><![CDATA[tutorial-python]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[tkinter]]></category>
            <dc:creator><![CDATA[Muhammad Osama]]></dc:creator>
            <pubDate>Fri, 06 Aug 2021 19:10:55 GMT</pubDate>
            <atom:updated>2021-08-06T19:47:53.502Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*jfwyEtwSvfpjhLSOEDeuWA.png" /></figure><p>Hello everyone!</p><p>This tutorial will guide you through the process of designing a Graphical User Interface (GUI) in Python. Many of you develop code and run it in a CLI or an IDE. A GUI is required if you want your software to have a fancy-looking interface. A graphical user interface (GUI) gives you an interface to interact with your computer.</p><p>There are several libraries in Python that may be used to design and develop a graphical user interface. Tkinter is the most common and straightforward.</p><h3><strong>Tkinter</strong></h3><p>Tkinter is Python’s standard GUI framework and is often packaged with Python. It uses Tk and is open-sourced. It is known for its simplicity and graphical user interface. The graphical interface is built using a range of regularly used GUI elements or called widgets (such as buttons, menus, labels, entry spaces, and so on).</p><p>Let’s install Python and Tkinter.</p><h4><strong>Step 1: Install Python</strong></h4><p>Type the below command in your cmd to check if python is installed:</p><pre>python --version</pre><p>If python is installed, then it will show you the latest version.<br>If Python is not installed on your pc then click the link below and install python:</p><pre><a href="https://www.python.org/downloads/">https://www.python.org/downloads/</a></pre><h4><strong>Step 2: Check pip</strong></h4><pre>pip -V</pre><p>If pip has been successfully installed on your system, the version will be displayed.</p><h4><strong>Step 3: Install Tkinter</strong></h4><p>Use the following command to install Tkinter using pip.</p><pre>pip install tk</pre><h3><strong>Let’s Get Started with Tkinter!</strong></h3><p>We will now build a simple GUI using Tkinter.</p><p>First, import the module in your code and create the root window.</p><pre>import tkinter as tk<br>root = tk.Tk()<br>root.mainloop()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/1*pkmxBY6MRw6KtIfCEJIYmw.png" /><figcaption>This is the window that will appear after running the above code.</figcaption></figure><p>Now, Let’s give this window a title instead of the ‘tk’ on the top left corner. Also, providing its size in pixels using the geometry. And finally, add a background color!</p><pre>import tkinter as tk<br>root = tk.Tk()<br>root.geometry(&#39;300x300&#39;)<br>root.title(&#39;my GUI&#39;)<br>root.config(bg=&#39;light green&#39;)<br>root.mainloop()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*cqhOTB60Rm6Ndomxg4lKzg.png" /></figure><p>Let’s add a label. A label is just a widget that displays text. We have to use the grid on this label to tell it where to place it on the window. Apart from grid, pack and place can also be used.</p><pre>import tkinter as tk<br>root = tk.Tk()<br>root.geometry(&#39;300x300&#39;)<br>root.title(&#39;my GUI&#39;)<br>root.config(bg=&#39;light green&#39;)<br>heading = tk.Label(root,text=&#39;This is a Label&#39;)<br>heading.grid(row=0,column=0)<br>root.mainloop()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*_kJYJmLScSJyrzC1ibSauA.png" /></figure><p>Let’s add a button.</p><pre>import tkinter as tk<br>root = tk.Tk()<br>root.geometry(&#39;300x300&#39;)<br>root.title(&#39;my GUI&#39;)<br>root.config(bg=&#39;light green&#39;)<br>heading = tk.Label(root,text=&#39;This is a Label&#39;)<br>heading.grid(row=0,column=0)<br>button = tk.Button(root, text=&#39;Click Me&#39;,width=10)<br>button.grid(row=1,column=0)<br>root.mainloop()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QJAxBzek7lsInD3mkX31Tg.png" /></figure><p>This is the end of the tutorial on getting started with Tkinter. <br>Next, we would see how to align the label and button and introduction to other widgets.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff28fe267566" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>