How to build cross platform Desktop GUI based apps with Python and web technologies and frameworks
You can also use any web framework based on Python such as the so popular Django framework or also the lightweight web development framework Flask to build business logic of your app and then wrap the whole app ,server and client side ,into a Desktop app .
What is PyWebView ?
PyWebView doens't reinvent the wheel but instead it uses the existing tools and native platform APIs.For providing a native window
for the target system it uses
Win32 API or Win Forms under Windows .
Cocoa on OS X .
GTK 3 ,QT4/5 under Linux .
Getting started with PyWebView
First of all ,make sure you have either Python 2 or 3 installed in your development machine .You also need PIP package manager installed then open up your terminal under Linux/MAC or command prompt under Windows and enter
pip install pywebview
If your installation fails make sure you have the following dependencies installed depending on your target system and re-execute the install command again .
Under Windows you need to install pywin32, comtypes if you want to use Win32 subsystem to create natives windows or pythonnet if you want to be able to use Windows Forms for native windows .
Under OS X you need to install pyobjc if it's not already installed in your system .
Under Linux GTK3 based distributions you have to install PyGObject before you can use PyWebView .
For QT based systems you need to install PyQt4/PyQt5 .
How to use pywebview ?
You can easilly get started with pywebview .Just execute the following Python code to launch a native window that displays a visited web URL .
import webview webview.create_window("Techiediaries", "http://www.techiediaries.com",width=800, height=600, resizable=True, fullscreen=False)
So you first start by importing the webview .Then use the create_window method to create and show a native window hich renders the content of http://www.techiediaries.com with the title "Techiediaries" .
All parameters are self explanatory they just control the width ,hieght and other properties of the window .
You can see a full example of a Flask app wrapped into a GUI app using pywebview under the GitHub repository of pywebview
While there are many Python based frameworks for building Desktop apps which are cross platform since Python itself is a portable and cross platform environment ,you have to learn these frameworks before you can build your apps but with pywebview you can use your existing web development skills and familiar Python web frameworks to create the web apps you have the skills to build and then wrap them into GUI based apps without starting from scratch .