Top 3 Python Liblaries For Gui
Python has useful libraries for GUI design. Today I will tell you about Tkinter, PyQt, Kivy from these libraries. So let’s start with Tkinter.
1. Tkinter
Tkinter is a Python GUI library that comes with Python.
That means you can run Tkinter with any computer has Python.
Tkinter is very popular because it comes with Python and has a simple structure.
But Tkinter does not include advanced widgets. It needs Ttk, PMW, TIX, and other extensions to provide some really useful widgets.
And also Tkinter does not include a designer like PyQt.
from tkinter import *
window = Tk()
window.title("Say hi to Tkinter")
window.mainloop()
This is a basic blank window with Tkinter.
2. PyQt
PyQt is a cross platform GUI design library for Python. That means you can use PyQt with any platform(Android,IOS,Windows…)
Get Mertcan Bilek’s stories in your inbox
Join Medium for free to get updates from this writer.
PyQt has own designer called QtDesigner.
PyQt has really usefull widgets. So you don’t need any other extension.
PyQt isn’t even limited to its widgets. Actually, PyQt has everything for an GUI design. For example, you can use QThread instead of Threading library. We can easily list many examples like this.
Apart from being difficult to learn some details, it doesn’t have much of a disadvantage.
from PyQt5.QtWidgets import *
from PyQt5 import QtCore
from PyQt5.QtGui import *
import sys
class Window(QMainWindow):
def __init__(self):
self.setStyleSheet("background-color: yellow;")
self.setWindowTitle("Color")
self.setGeometry(0, 0, 400, 400)
self.show()
App = QApplication(sys.argv)
window = Window()
sys.exit(App.exec())
This is a blank yellow window with PyQt5.
2. Kivy
Kivy is well known Python framework for being compatible with android. But of course it is also compatible with other platforms.
With Kivy you can design user interfaces with multi-touch functionalities.
Kivy has own designer called ‘Kivy Designer’.
import kivy
kivy.require('2.1.0') # replace with your current kivy version !
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text='Hello world')
if __name__ == '__main__':
MyApp().run()
This is a blank window with “Hello world” label.







