In this article iam going to talk about Python Top GUI Frameworks For Learning , also iam going to show you the installation process with simple example on each GUI Framework. so as you know python is one the most top and trending programming language, and there are alot of gui frameworks that you can use, but in this article we want to know about the top gui frameworks in python, so now let’s get started.
Also you can check the complete tutorial for python GUI Frameworks
1: PyQt5 GUI Development Complete Tutorials
2: TKinter GUI Development For Beginners
3: Pyside2 GUI Development For Beginners
4: wxPython GUI Full Course For Beginners
PyQt5 is a Graphical User Interface GUI Framework for python. It is one of the best, powerful and popular Python GUI Framework. PyQt is a binding of Qt5 C++ a gui framework for c++ developers. You can create program in pyqt5 using coding or a using qt designer a visual dialog that you can drag and drop UI widgets
PyQt5 is a free Python bindings software open-source widget-toolkit Qt, implemented for cross-platform application development framework. In the free version, certain features may not be available but if your application is open source then you can use it under a free license. PyQt is available on Windows, MacOSX, Linux, Android iOS and Raspberry Pi.
pip install pyqt5
from PyQt5.QtWidgets import QApplication, QMainWindow
import sys
from PyQt5 import QtGui
class Window(QMainWindow):
def __init__(self):
super().__init__()
self.setGeometry(300, 300, 500, 400)
self.setWindowTitle("PyQt5 Window")
self.show()
App = QApplication(sys.argv)
window = Window()
sys.exit(App.exec())
Run the above code and this will be the result
Tkinter is the most popular programming package for graphical user interface or desktop apps. It is so named because of its simplicity. Tkinter is the combination of Tk and Python’s standard GUI framework.
Tkinter It provides diverse widgets, such as labels, buttons, and text boxes used in a graphical user interface application. The Button control also called widgets are used to display buttons in developed application while the Canvas widget is used to draw shapes (lines, ovals, polygon…) in your application. It is a built in library for python.
It is a built in library in python, no need to install
from tkinter import *
class Root(Tk):
def __init__(self):
super(Root, self).__init__()
self.title("Python Tkinter First Window")
self.minsize(640, 400)
root = Root()
root.mainloop()
Run the above code and this will be the result
Qt for Python offers the official Python bindings for Qt (PySide2), enabling the use of its APIs in Python applications, and a binding generator tool (Shiboken2) which can be used to expose C++ projects into Python.
Qt for Python is available under the LGPLv3/GPLv3 and the Qt commercial license.
pip install PySide2
from PySide2.QtWidgets import QApplication,QWidget
import sys
import time
class Window(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("Pyside2 Simple Application")
self.setGeometry(300,300,500,400)
myApp = QApplication(sys.argv)
window = Window()
window.show()
myApp.exec_()
sys.exit(0)
So run the above code and this will be the result
Kivy is Open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps. There are some features for kivy like.
Before installing Kivy, you need to install the following dependency and after that you can install kivy
pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew
pip install Kivy
from kivy.app import App
from kivy.uix.button import Button
class TestApp(App):
def build(self):
return Button(text = "Hello Kivy World")
TestApp().run()
So run the above code and this will be the result
wxPython is a cross-platform GUI toolkit for the Python programming language. It allows Python programmers to create programs with a robust, highly functional graphical user interface, simply and easily. It is implemented as a set of Python extension modules that wrap the GUI components of the popular wxWidgets cross platform library, which is written in C++.
Like Python and wxWidgets, wxPython is Open Source, which means that it is free for anyone to use and the source code is available for anyone to look at and modify. And anyone can contribute fixes or enhancements to the project.
wxPython is a cross-platform toolkit. This means that the same program will run on multiple platforms without modification. Currently Supported platforms are Microsoft Windows, Mac OS X and macOS, and Linux.
pip install wxPython
import wx
class MyFrame(wx.Frame):
def __init__(self, parent, title):
super(MyFrame, self).__init__(parent, title=title, size = (400,300))
self.panel = MyPanel(self)
class MyPanel(wx.Panel):
def __init__(self, parent):
super(MyPanel, self).__init__(parent)
class MyApp(wx.App):
def OnInit(self):
self.frame = MyFrame(parent=None, title="wxPython Window")
self.frame.Show()
return True
app = MyApp()
app.MainLoop()
So now run the above code and this will be the result
Also you can watch the complete video tutorial for this article (Python Top GUI Frameworks For Learning )
#python #machine-learning #web-development #data-science