PYTHON TOOLKIT

An advanced language and emerged, Python has emerged as the most promising programming environment for machine learning. In our online Python Tutorial, let us know what consists of Python toolkit!

PYTHON TOOLKIT
 11th Sep, 2019
 2551 Views

What is Python?

Python is a high­ level programming language.  It can be easily used with other languages such as C, C++, broadening the range of its application to nearly all fields of programming. Programming in Python is fun because selected lines of code are needed compared to other programming languages to get the desired output.

Check this insightful Intellipaat Python video:

Python interpreters are available for the installation on different operating systems, allowing the code execution on a wide variety of systems. There are three tools in its toolkit:

  • wxPython
  • PyQt
  • PyGTK

wxPython

wxPython is a blend of wxWidgets and programming library. It is a popular cross-platform GUI toolkit. wxWidgets is a wrapper written in C++. It has lots of widgets. They are divided into logical groups.

  • Base Widgets
  • Top level Widgets
  • Containers
  • Dynamic Widgets
  • Static Widgets
  • Other Widgets

Want to learn in detail? Read this extensive Python tutorial!

Principal modules in wxPython API include a core module. It consists of  wxObject class, which is the base for all classes in the API. Control module contains all the widgets used in GUI application development.

Example: wx.Button, wx.StaticText (analogous to a label), wx.TextCtrl (editable text control), etc.

Windows

Prebuilt binaries for Windows OS (32 bit and 64 bit) are available on http://www.wxpython.org/download.php page. Latest versions of installers are available on wxPython3.0-win32-3.0.2.0-py27.exe (32-bit Python 2.7) wxPython3.0-win64-3.0.2.0-py27.exe (64-bit Python 2.7)

A simple GUI application displaying Hello World message is built using the following steps −

  • Import wx module.
  • Define an object of Application class.
  • Create a top level window as object of wx.Frame class. Caption and size parameters are given in constructor.
  • Although other controls can be added in Frame object, their layout cannot be managed. Hence, put a Panel object into the Frame.
  • Add a StaticText object to display ‘Hello World’ at a desired position inside the window.
  • Activate the frame window by show() method.
  • Enter the main event loop of Application object.

Code:

import wx
 app = wx.App()
window = wx.Frame(None, title = "wxPython Frame", size = (300,200))
panel = wx.Panel(window)
label = wx.StaticText(panel, label = "Hello World", pos = (100,50))
window.Show(True)
app.MainLoop()

Output:

Hello World

Get top developer jobs by learning these Python Interview Questions

PyQt

PyQt is a set of Python v2 and v3 bindings for The Qt Company’s Qt application framework and runs on all platforms supported by Qt including Windows, MacOS/X and Linux. PyQt is one of the two most popular Python bindings for the Qt cross-platform GUI/XML/SQL C++ framework.

PyQt is available in two editions:

  • PyQt4 which will build against Qt 4.x and 5.x
  • PyQt5 which will only build against 5.x.

PyQt contains over 620 classes that cover graphical user interfaces, XML handling, network communication, SQL databases, Web browsing and other technologies available in Qt. The latest iteration of PyQt is v5.4.
Check this insightful Intellipaat Python video:

PyGTK

PyGTK helps in creating programs with a graphical user interface using the Python programming language. It is a set of wrappers for the GTK+ graphical user interface library.

It provides an object-oriented interface that is slightly higher level than the C programming language. It is easy to install on UNIX. Win32 installer versions are available, and Mac OS X versions are in development.

KiWi is a set of classes and wrappers for PyGTK that were developed to provide a sort of framework for applications.

Get a complete hands-on experience on programming skills by enrolling into Python online Training Course and earn your certification in Python. Intellipat is also providing free guides to prepare for interviews with it’s Python Interview Questions.

 

Related Articles

Leave a Reply

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