<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Nicolas Agudelo</title>
    <description>The latest articles on Forem by Nicolas Agudelo (@nicolasagudelo).</description>
    <link>https://forem.com/nicolasagudelo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F884206%2F2b44a952-f39c-407b-ac14-e11dffd34960.jpeg</url>
      <title>Forem: Nicolas Agudelo</title>
      <link>https://forem.com/nicolasagudelo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nicolasagudelo"/>
    <language>en</language>
    <item>
      <title>Folder Organizer Using Python and Tkinter</title>
      <dc:creator>Nicolas Agudelo</dc:creator>
      <pubDate>Fri, 01 Jul 2022 01:16:23 +0000</pubDate>
      <link>https://forem.com/nicolasagudelo/folder-organizer-using-python-and-tkinter-37cb</link>
      <guid>https://forem.com/nicolasagudelo/folder-organizer-using-python-and-tkinter-37cb</guid>
      <description>&lt;p&gt;Hello everyone!&lt;/p&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FcWxnHRx.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FcWxnHRx.gif" alt="Folder Organizer" title="Folder Organizer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;center&gt; &lt;em&gt;Folder Organizer&lt;/em&gt; &lt;/center&gt;




&lt;p&gt;Here is my approach to an application to organize the files you have on any folder on your computer sorting them according to their extension.&lt;/p&gt;



&lt;p&gt;This was also the first time I experimented creating a (super simple) user interface on python instead of having the user doing everything on the terminal. I used the module &lt;code&gt;Tkinter&lt;/code&gt; to create this window for the user to interact with.&lt;/p&gt;



&lt;ul&gt;
&lt;li&gt;Creating the User Interface&lt;/li&gt;
&lt;li&gt;Pressing the Start Button&lt;/li&gt;
&lt;li&gt;The organize() function&lt;/li&gt;
&lt;li&gt;Installing the Application&lt;/li&gt;
&lt;li&gt;Closing notes&lt;/li&gt;
&lt;/ul&gt;



&lt;h2&gt;
  
  
  Creating the User Interface
&lt;/h2&gt;



&lt;p&gt;The first step was creating the main window. Using the Tkinter module, we can create an object of the class &lt;strong&gt;&lt;em&gt;tkinter.Tk&lt;/em&gt;&lt;/strong&gt;. &lt;br&gt;
In my case, I called it root as most of the examples I found on using this module.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Creating the main window for the user interface.
&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Tk&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, I started personalizing my &lt;code&gt;root&lt;/code&gt; object or main window. Changing the default icon for a free personalized icon, I found at &lt;a href="https://freeicons.io/ecommerce-back-office-system-icon-set-2/fulfillment-automatic-packing-factory-order-machine-sort-icon-382620" rel="noopener noreferrer"&gt; freeicons.io&lt;/a&gt; (thanks to Ginkaewicons who created the icon.), setting the window geometry and adding a title to it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Replace the default icon
&lt;/span&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;iconbitmap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;organizer.ico&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;pass&lt;/span&gt;

&lt;span class="c1"&gt;# Setting up the geometry of the window.
&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;geometry&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;320x195&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# By setting both parameters to false the user can not resize the window.
&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resizable&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# We make sure the program gets the main focus on the user's Desktop.
&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;focus&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Title of the main window
&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;title&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Organizer.py&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, I decided on the widgets I wanted the main window to have.&lt;/p&gt;

&lt;p&gt;In my case, I decided to add:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A Label that will give information to the user about what the program does, what it is expecting, or when it has finished.&lt;/li&gt;
&lt;li&gt;A Start Button which will start the primary function of the program.&lt;/li&gt;
&lt;li&gt;A Progress Bar that gives the user a visual reference that tells him that the program is doing something and when it has finished.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Creating our start button, which will start the program.
&lt;/span&gt;
&lt;span class="n"&gt;startbutton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                   &lt;span class="c1"&gt;# Setting the 'master' window for this widget
&lt;/span&gt;    &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Start&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;         &lt;span class="c1"&gt;# Setting the text to display on this widget
&lt;/span&gt;    &lt;span class="n"&gt;command&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;find_dir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="c1"&gt;# This will be the function that executes when you press the button.
&lt;/span&gt;    &lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;hand2&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;         &lt;span class="c1"&gt;# This will change the cursor when the user hovers it over the button.
&lt;/span&gt;    &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# A description label to give information to the user about the program status.
&lt;/span&gt;
&lt;span class="n"&gt;description_label&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Label&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                   &lt;span class="c1"&gt;# Setting the 'master' window for this widget
&lt;/span&gt;                            &lt;span class="c1"&gt;# Setting the text to display on this widget
&lt;/span&gt;    &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;You can use this program to organize all your different &lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;type of files in folders&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="s"&gt;Just choose the folder that you want to organize&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;by clicking the Start button below&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;justify&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;left&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;         &lt;span class="c1"&gt;# With this, every new line will start at the left of the label.
&lt;/span&gt;    &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# A progress bar for the user to follow the program's progress.
&lt;/span&gt;
&lt;span class="n"&gt;progressbar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ttk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Progressbar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                   &lt;span class="c1"&gt;# Setting the 'master' window for this widget
&lt;/span&gt;    &lt;span class="n"&gt;orient&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;HORIZONTAL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;      &lt;span class="c1"&gt;# Setting the progress bar horizontally
&lt;/span&gt;    &lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;240&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;           &lt;span class="c1"&gt;# Setting the lenght of the progress bar in pixels
&lt;/span&gt;    &lt;span class="n"&gt;mode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;determinate&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;    &lt;span class="c1"&gt;# We know when our program finishes so we use the determinate mode
&lt;/span&gt;    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can find information about all of the attributes of these and more widgets &lt;a href="https://docs.python.org/3/library/tkinter.ttk.html#" rel="noopener noreferrer"&gt;here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, I placed the objects in the main window:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;#Placing the objects we created for our user interface.
&lt;/span&gt;
&lt;span class="n"&gt;description_label&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;place&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;startbutton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;place&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;140&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;140&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;progressbar&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pack&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;side&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;bottom&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pady&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since the user can not resize the window, I placed the label and button at specific positions using the &lt;strong&gt;&lt;em&gt;x&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;y&lt;/em&gt;&lt;/strong&gt; axes. For the progress bar, I put it at the bottom of the window, adding a 5px padding on top and bottom to avoid having it entirely on the window's border.&lt;/p&gt;

&lt;p&gt;After doing this we get our main window:&lt;/p&gt;

&lt;p&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2F4ObDxIj.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2F4ObDxIj.jpg" alt="Main Window" title="Main Window"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;center&gt;&lt;em&gt;Main Window&lt;/em&gt;&lt;/center&gt;




&lt;h2&gt;
  
  
  Pressing the Start Button
&lt;/h2&gt;



&lt;p&gt;Now that the main window is done the start button will be the one responsible of doing what the main goal of the program is. Once it is pressed it will call the &lt;code&gt;find_dir()&lt;/code&gt; function which will prompt the user about which folder he wants to organize using the &lt;code&gt;filedialog&lt;/code&gt; method from the Tkinter module.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# The find dir function will ask the user for the folder he wants to organize. 
# In case he presses 'Cancel', the `dirname` variable will be empty
# In this case, we ask the user to please select a folder to be able to organize it
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;find_dir&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;global&lt;/span&gt; &lt;span class="n"&gt;description_label&lt;/span&gt;
    &lt;span class="n"&gt;frm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ttk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Frame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;padding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;ttk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Label&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Select the folder that you want to organize&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;dirname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;filedialog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;askdirectory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;parent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;initialdir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;~&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Select the folder that you want to organize&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# If the user closes the file dialog or presses cancel the dirname will be empty in this case, we change the text on the label of the main window and do nothing else.
&lt;/span&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;dirname&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;''&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;description_label&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;text&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Please select a folder to continue&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="s"&gt;Just choose the folder that you want to organize&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;by clicking the Start button below&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Once we have the directory that the user wants to organize we pass it to the function organize()
&lt;/span&gt;        &lt;span class="nf"&gt;organize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dirname&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FnR5fova.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FnR5fova.jpg" alt="Selecting the Folder" title="Selecting the Folder"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;center&gt;&lt;em&gt;Selecting the Folder&lt;/em&gt;&lt;/center&gt;




&lt;p&gt;If the user closes the window asking for the folder or presses 'Cancel' the program will return to the main window and inform him that a folder is needed for the program to work allowing him to press the start button to start the process again.&lt;/p&gt;

&lt;p&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FnjnljvL.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FnjnljvL.jpg" alt="Not Selecting the Folder" title="Not Selecting the Folder"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;center&gt;&lt;em&gt;Message displayed when no folder was selected&lt;/em&gt;&lt;/center&gt;




&lt;p&gt;After that, if the user selected a folder, two things could happen:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;There are no files on the selected folder, in which case the program will inform the user about it and give him the option to press the start button again if he wants to.
&lt;p&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2Fa0NPJD4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2Fa0NPJD4.jpg" alt="Folder with no files" title="Folder with no files"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;center&gt;&lt;em&gt;Message displayed when a folder with no files was selected&lt;/em&gt;&lt;/center&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;ol&gt;
&lt;li&gt;There are files on the selected folder in which case the program will call the &lt;code&gt;organize()&lt;/code&gt; function which will then organize all the files into folders.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FrOnyHII.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FrOnyHII.jpg" alt="Folder Organized Message" title="Folder Organized Message"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;center&gt;
&lt;em&gt;Folder Organized Message&lt;/em&gt;
&lt;/center&gt;




&lt;h2&gt;
  
  
  The organize() function
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;organize()&lt;/code&gt; function is in charge of putting every file in the correct folder. To achieve this, I created different categories of files, and using &lt;code&gt;match case&lt;/code&gt;, I assigned every file to a folder. In case there is an extension that doesn't fall into any of the categories I created, the program will put it into a folder called &lt;em&gt;Others&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I won't put the portion of the code that does this here because it's a little bit too long, but you can check the code &lt;a href="https://github.com/nicolasagudelo/Folder_Organizer" rel="noopener noreferrer"&gt;here&lt;/a&gt; to see the categories I created and what extension falls into each category.&lt;/p&gt;

&lt;p&gt;Thanks to &lt;a href="https://www.file-extensions.org/" rel="noopener noreferrer"&gt;file-extensions.org&lt;/a&gt;, the place from where I got lists of the most common file extensions and got the idea of how to name each category.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing the Application
&lt;/h2&gt;

&lt;p&gt;You can find the code for the application at &lt;a href="https://github.com/nicolasagudelo/Folder_Organizer" rel="noopener noreferrer"&gt;this repository&lt;/a&gt; at GitHub.&lt;/p&gt;

&lt;p&gt;You can also download the executable on this &lt;a href="https://github.com/nicolasagudelo/Folder_Organizer/releases/download/v1.0/folder_organizer.zip" rel="noopener noreferrer"&gt;link&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing notes
&lt;/h2&gt;

&lt;p&gt;Feel free to contact me through my email (public on my profile) if you find any issue or problem with the application or if you have any advice about how something might be better implemented. You can also try adding more stuff to the application; I would love to see that.&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;

</description>
      <category>python</category>
      <category>productivity</category>
      <category>github</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Hero's Journey a text-based RPG Game.</title>
      <dc:creator>Nicolas Agudelo</dc:creator>
      <pubDate>Tue, 28 Jun 2022 23:58:45 +0000</pubDate>
      <link>https://forem.com/nicolasagudelo/heros-journey-a-text-based-rpg-game-1cm4</link>
      <guid>https://forem.com/nicolasagudelo/heros-journey-a-text-based-rpg-game-1cm4</guid>
      <description>&lt;h1&gt;
  
  
  Hero's Journey V1.0
&lt;/h1&gt;

&lt;p&gt;Hello everybody!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FI6rYZqg.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FI6rYZqg.jpg" alt="Greeting Message" title="Greeting Message"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
This is the first working version of the python text-based RPG game that I have called &lt;strong&gt;&lt;em&gt;Hero's Journey.&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;In this game, you will find yourself in the shoes of the hero who must defeat the Demon King to bring peace back to his world.&lt;/p&gt;



&lt;p&gt;To do this, you must train and level up to improve your stats, you will do this by fighting against different enemies (minions of the Demon King), gaining experience, potions, and money once you defeat them, money, that you will be able to then use on the store to buy more potions to help you on your adventure.&lt;/p&gt;



&lt;p&gt;Be careful with how much you risk while training or when fighting the bosses since if you are left with no more health points, you will lose all your potions and part of your money.&lt;/p&gt;



&lt;p&gt;The game is divided into six sections.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Hero's Journey V1.0

&lt;ul&gt;
&lt;li&gt;Game Start&lt;/li&gt;
&lt;li&gt;The Village&lt;/li&gt;
&lt;li&gt;Training Grounds&lt;/li&gt;
&lt;li&gt;Store&lt;/li&gt;
&lt;li&gt;Check Stats&lt;/li&gt;
&lt;li&gt;Battle Boss&lt;/li&gt;
&lt;li&gt;Installing the game&lt;/li&gt;
&lt;li&gt;Closing notes&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Game Start
&lt;/h2&gt;

&lt;p&gt;At the beginning of the game, the game will ask you for your name, and you will receive ten stat points to distribute as you wish on four different attributes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Attack: Determines how much damage the player deals&lt;/li&gt;
&lt;li&gt;Defense: Determines how much damage the player ignores.&lt;/li&gt;
&lt;li&gt;Speed: Determines the chance of the player avoiding an enemy attack.&lt;/li&gt;
&lt;li&gt;Crit Chance: Determines the chance of the player hitting a critical strike when attacking.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once you have done this, the game will take you to The Village&lt;/p&gt;

&lt;h2&gt;
  
  
  The Village
&lt;/h2&gt;

&lt;p&gt;This is basically the game's menu, where you can choose what to do next.&lt;/p&gt;

&lt;p&gt;You will recover your HP every time you come back to the Village and also be transported back here when an enemy defeats you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2Fk2VnjPs.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2Fk2VnjPs.jpg" alt="Game's Menu" title="Game's Menu"&gt;&lt;/a&gt;&lt;/p&gt;
 &lt;em&gt;Game's Menu&lt;/em&gt;



&lt;h2&gt;
  
  
  Training Grounds
&lt;/h2&gt;

&lt;p&gt;Here is where you will face the minions of the Demon King, accumulating experience, potions, and money.&lt;/p&gt;

&lt;p&gt;You will face each of them in turn-based combat, where the player will choose between using a potion to recover some health or attacking the enemy in front. &lt;/p&gt;

&lt;p&gt;Once you decide to attack, it will be the enemy's turn to attack you.&lt;/p&gt;

&lt;p&gt;Using potions in combat will not make the player lose his turn.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fadsu09xwol9i6wd3rdq5.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fadsu09xwol9i6wd3rdq5.gif" alt="Battle Against Minion" title="Battle Against Minion"&gt;&lt;/a&gt;&lt;/p&gt;
 &lt;em&gt;Battle Example&lt;/em&gt;





&lt;p&gt;Once you defeat the enemy, you will be given the option to continue training which will set up another combat, or go back to the village to recover your HP.&lt;/p&gt;

&lt;h2&gt;
  
  
  Store
&lt;/h2&gt;

&lt;p&gt;Here you will be able to spend the money you have won by killing enemies on potions.&lt;/p&gt;

&lt;p&gt;Potions are handy if you want to stay training for a while or if you are going to face one of the game's bosses.&lt;/p&gt;

&lt;p&gt;Each potion will recover 20% of your maximum health, and you can carry a maximum amount of 10 potions at a time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2F59DnsM4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2F59DnsM4.jpg" alt="Store" title="Store"&gt;&lt;/a&gt;&lt;/p&gt;
 &lt;em&gt;Store&lt;/em&gt;



&lt;h2&gt;
  
  
  Check Stats
&lt;/h2&gt;

&lt;p&gt;As you level up through the game you will accumulate stat points to improve your attributes. Here is where you can spend all those stat points on the 4 different attributes mentioned at the Game Start section as well as checking what your current stats are:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FgRkZHDc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FgRkZHDc.jpg" alt="Checking the player Stats" title="Player Stats"&gt;&lt;/a&gt;&lt;/p&gt;
 &lt;em&gt;Player Stats&lt;/em&gt;





&lt;p&gt;The player can choose how he wants to spend his stat points; however, every attribute will reach its maximum level once it reaches level 10.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FyqlwbTj.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FyqlwbTj.jpg" alt="Spending Stat Points" title="Spending Stat points"&gt;&lt;/a&gt;&lt;/p&gt;
 &lt;em&gt;Spending Stat Points&lt;/em&gt;





&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FKHyO48F.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FKHyO48F.jpg" alt="Stat Points Used" title="Stat points Used"&gt;&lt;/a&gt;&lt;/p&gt;
 &lt;em&gt;Stat Points Used&lt;/em&gt;



&lt;h2&gt;
  
  
  Battle Boss
&lt;/h2&gt;

&lt;p&gt;The game has four bosses.&lt;/p&gt;

&lt;p&gt;The three generals of the army:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Abadon&lt;/li&gt;
&lt;li&gt;Mammon&lt;/li&gt;
&lt;li&gt;Belphegor&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And the Demon King himself: &lt;strong&gt;Lucifer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The combat mechanics against the bosses are the same as with the minions; however, bosses are much more robust. If the player has not trained enough, it might be virtually impossible to defeat them until the player reaches a certain level.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FxiVDp1T.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FxiVDp1T.jpg" alt="Fighting the Boss without proper training" title="Fighting the Boss without proper training"&gt;&lt;/a&gt;&lt;/p&gt;
 &lt;em&gt;Fighting Without Training&lt;/em&gt;



&lt;h2&gt;
  
  
  Installing the game
&lt;/h2&gt;

&lt;p&gt;You can find the code for the game at &lt;a href="https://github.com/nicolasagudelo/hero_journey" rel="noopener noreferrer"&gt;this repository&lt;/a&gt; at github.&lt;/p&gt;

&lt;p&gt;You can also download the executable on this &lt;a href="https://github.com/nicolasagudelo/hero_journey/releases/download/v1.0/hero_journey.zip" rel="noopener noreferrer"&gt;link&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing notes
&lt;/h2&gt;

&lt;p&gt;Feel free to contact me through my email (public on my profile) if you find any issue or problem with the game or if you have any advice about how something might be better implemented. You can also try adding more stuff to the game I would love to see that.&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;

</description>
      <category>python</category>
      <category>codecademy</category>
      <category>beginners</category>
      <category>github</category>
    </item>
  </channel>
</rss>
