Python GUI Programming Part-1 (Introduction)

Spread to the Techies
Welcome to Techiehunters Blog.

Today we are going to learn about GUI programming with python language.

What is GUI programming?

GUI stands for, Graphical User Interface. That means we are going to learn about Graphical programming with python. There are lots of GUI frameworks (or toolkit) for python from Tkinter. We will start with tk for building desktop applications using python.

IDE or Code Editors:

We will use PyCharm community edition from JetBrains as our IDE to write and run codes. As this is the best free IDE developed for the students for learning purpose we will get the most of the important features to develop both desktop and web based python applications. Download it from the link then install and open it.

Now,

Go to file and create a new project

Write a name for the project in the path (just replace the name untitled)

Now you will get a dialog box that will ask you to select How would you like to start your project. Select Open in Current window and tick on the Add to currently opened projects.

Now wait till the IDE finished the setup process for your project with the required and useful libraries.

After finishing the setup of your project you will get a page

Now click on your project and right click for options. Select new python file

Then write the following code.

from tkinter import *

root = Tk()
viewPanel = Label(root,  text='This is a test')
viewPanel.pack()
root.mainloop()

Now you can’t run the code directly. You will have to show the IDE the source code path. See the image,

 

Click on edit configuration then select the script path which will be your python file that you want to run.
Then click on run….
Boom……………………

What did you see??? Yeah you have created a frame on Tkinter. Share this blog with your friends and family if you think they need it and it is useful. Remember Sharing is caring. Thank you.

Stay tuned for the next part. Till then happy coding.

Leave a Reply

Your email address will not be published. Required fields are marked *