Today we are going to learn about Python GUI Programming.
What is Python GUI programming?
GUI stands for, Graphical User Interface. That means we are going to learn about Graphical programming with Python. Using the GUI program you can build software and web applications.
There are lots of GUI frameworks (or toolkits) for Python from Tkinter. We will start with tk for building desktop applications using Python.
IDE or Code Editors for GUI Programming:
We will use the 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 purposes 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 the 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 the 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 a 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 the 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.