Facebooktwittergoogle_plusredditpinterestlinkedinmail

Learning to program in Python is fun and exciting. You can create your own scripts to automate certain tasks and even create apps with a GUI (graphical user interface). 2 different versions are available: Python 2.7 and 3.5 (3.6 is now out). Both Python 2 and 3 are good, but the future is certainly with Python 3.

In most Linux distros, both Python 2 and 3 are already installed. All you need now is a Python IDE (integrated development environment) that allows the creation of professional applications using Python. My favorite one is Pycharm which is a cross platform application. You can launch the application and choose what version of Python you wish to use. You can then create a new project for your scripts. By default, it will automatically create a “PycharmProjects” folder.

 

The screen shot above is an example of a window created with just a few lines of Python3 code. You can add labels, buttons, entry boxes and all kinds of other widgets.

Code for the window above:

from tkinter import *

root = Tk()
root.title(‘My first app’)
root.geometry(‘400×400’)

label1 = Label(text=’My label’)
label1.pack(pady=20)
button1 = Button(text=’My button’)
button1.pack()

entry1 = Entry()
entry1.pack()
root.mainloop()

Another tool you can use is called Idle. You can install it in your terminal with the following:

sudo apt install idle (for python 2)
sudo apt install idle3 (for Python 3)
There are very good tutorials on YouTube to get started. Here are a few that i recommend:

Another great tutorial is “Learning Python the hard way”. It’s an online book that will help you understand the basics of Python. You can also find other free Python ebooks in pdf format by just using your favorite search engine.

~teklordz