wxPython is a
wrapper for the
cross-platform
In computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several computing platforms. Some cross-platform software r ...
GUI
The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inste ...
API
An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
(often referred to as a "
toolkit A toolkit is an assembly of tools; set of basic building units for user interfaces.
The word toolkit may refer to:
* Abstract Window Toolkit
* Accessibility Toolkit
* Adventure Game Toolkit
* B-Toolkit
* Battlefield Mod Development Toolkit
* Ch ...
")
wxWidgets
wxWidgets (formerly wxWindows) is a widget toolkit and tools library for creating graphical user interfaces (GUIs) for cross-platform applications. wxWidgets enables a program's GUI code to compile and run on several computer platforms with mini ...
(which is written in
C++
C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
) for the
Python programming language
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.
Python is dynamically-typed and garbage-collected. It supports multiple programming p ...
. It is one of the alternatives to
Tkinter
Tkinter is a Python binding to the Tk GUI toolkit. It is the standard Python interface to the Tk GUI toolkit, and is Python's ''de facto'' standard GUI. Tkinter is included with standard Linux, Microsoft Windows and macOS installs of Python.
Th ...
. It is implemented as a Python extension module (
native code
In computer programming, machine code is any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a very ...
).
History
In 1995, Robin Dunn needed a
GUI
The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inste ...
application to be deployed on
HP-UX
HP-UX (from "Hewlett Packard Unix") is Hewlett Packard Enterprise's proprietary implementation of the Unix operating system, based on Unix System V (initially System III) and first released in 1984. Current versions support HPE Integrity Ser ...
systems but also run
Windows 3.1
Windows 3.1 is a major release of Microsoft Windows. It was released to manufacturing on April 6, 1992, as a successor to Windows 3.0.
Like its predecessors, the Windows 3.1 series ran as a shell on top of MS-DOS. Codenamed Janus, Windows 3 ...
within short time frame. He needed a cross-platform solution. While evaluating free and commercial solutions, he ran across
Python
Python may refer to:
Snakes
* Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia
** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia
* Python (mythology), a mythical serpent
Computing
* Python (pro ...
bindings on the wxWidgets toolkit webpage (known as wxWindows at the time). This was Dunn's introduction to Python. Together with Harri Pasanen and Edward Zimmerman he
developed those initial bindings into wxPython 0.2.
In August 1998, version 0.3 of wxPython was released. It was built for wxWidgets 2.0 and ran on Win32, with a wxGTK version in the works.
The first versions of the wrapper were created by hand. However, the code became difficult to maintain and keep synchronized with wxWidgets releases. By 1997, versions were created with
SWIG, greatly decreasing the amount of work to update the wrapper.
Project Phoenix
In 2010, the Project Phoenix began; an effort to clean up the wxPython implementation and in the process make it compatible with Python 3. The project is a new implementation of wxPython, focused on improving speed, maintainability and extensibility. Like previous version of wxPython, it wraps the wxWidgets C++ toolkit and provides access to the user interface portions of the wxWidgets API.
With the release of 4.0.0a1 wxPython in 2017, the Project Phoenix version became the official version. wxPython 4.x is the current version being developed as of June 2022.
Use
wxPython enables Python to be used for cross-platform
GUI
The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inste ...
applications requiring very little, if any, platform-specific code.
Example
This is a simple "
Hello world
''Hello'' is a salutation or greeting in the English language. It is first attested in writing from 1826. Early uses
''Hello'', with that spelling, was used in publications in the U.S. as early as the 18 October 1826 edition of the ''Norwich C ...
" module, depicting the creation of the two main objects in wxPython (the main window object and the application object), followed by passing the control to the event-driven system (by calling
MainLoop()
) which manages the user-interactive part of the program.
#!/usr/bin/env python3
import wx
app = wx.App(False) # Create a new app, don't redirect stdout/stderr to a window.
frame = wx.Frame(None, title="Hello World") # A Frame is a top-level window.
frame.Show(True) # Show the frame.
app.MainLoop()
This is another example of wxPython Close Button with wxPython GUI display show in Windows 10 operation system.
import wx
class WxButton(wx.Frame):
def __init__(self, *args, **kw):
super(WxButton, self).__init__(*args, **kw)
self.InitUI()
def InitUI(self):
pnl = wx.Panel(self)
closeButton = wx.Button(pnl, label='Close Me', pos=(20, 20))
closeButton.Bind(wx.EVT_BUTTON, self.OnClose)
self.SetSize((350, 250))
self.SetTitle('Close Button')
self.Centre()
def OnClose(self, e):
self.Close(True)
def main():
app = wx.App()
ex = WxButton(None)
ex.Show()
app.MainLoop()
if __name__ "__main__":
main()
License
Being a wrapper, wxPython uses the same
free software licence
A free-software license is a notice that grants the recipient of a piece of software extensive rights to modify and redistribute that software. These actions are usually prohibited by copyright law, but the rights-holder (usually the author) ...
used by
wxWidgets
wxWidgets (formerly wxWindows) is a widget toolkit and tools library for creating graphical user interfaces (GUIs) for cross-platform applications. wxWidgets enables a program's GUI code to compile and run on several computer platforms with mini ...
(
wxWindows License)—which is approved by
Free Software Foundation
The Free Software Foundation (FSF) is a 501(c)#501(c)(3), 501(c)(3) non-profit organization founded by Richard Stallman on October 4, 1985, to support the free software movement, with the organization's preference for software being distributed ...
and
Open Source Initiative
The Open Source Initiative (OSI) is the steward of the Open Source Definition, the set of rules that define open source software. It is a California public-benefit nonprofit corporation,_with_501(c)(3).html" ;"title="110. - 6910./ref> is a type o ...
.
Applications developed with wxPython
*
Chandler
Chandler or The Chandler may refer to:
* Chandler (occupation), originally head of the medieval household office responsible for candles, now a person who makes or sells candles
* Ship chandler, a dealer in supplies or equipment for ships
Arts ...
, a personal information manager
*
Dropbox
Dropbox is a file hosting service operated by the American company Dropbox, Inc., headquartered in San Francisco, California, U.S. that offers cloud storage, file synchronization, personal cloud, and Client (computing), client software. Dropb ...
, desktop client for the Dropbox cloud-based storage
*
Editra
Editra is a cross-platform, open-source software, open-source text editor, released under a wxWindows license. It is written by Cody Precord in Python (programming language), Python, and it was first publicly released in June 2007. As of November ...
, a multi-platform text editor
*
Google Drive
Google Drive is a file storage and synchronization service developed by Google. Launched on April 24, 2012, Google Drive allows users to store files in the cloud (on Google's servers), synchronize files across devices, and share files. In addi ...
, desktop client for the Google cloud-based storage system
*
GRASS GIS
''Geographic Resources Analysis Support System'' (commonly termed ''GRASS GIS'') is a geographic information system (GIS) software suite used for geospatial data management and analysis, image processing, producing graphics and maps, spatial and ...
, a free, open source geographical information system
*
Métamorphose, a batch renamer
*
Phatch
Phatch (PHoto & bATCH) is a raster graphics editor used to batch process digital graphics and photographs. Phatch can be used on the desktop as a GUI program or on the server as a console program.
Operation
Typical actions include resizing, ...
, a photo batch processor
*
PlayOnLinux
PlayOnLinux is a graphical frontend for the Wine software compatibility layer which allows Linux users to install Windows-based video games, Microsoft Office (2000 to 2010), Microsoft Internet Explorer, as well as many other applications such as ...
and
PlayOnMac
PlayOnMac is a free compatibility layer and emulator for macOS that allows installation and usage of video games and other software initially designed to run exclusively on Microsoft Windows. PlayOnMac is based on the open-source Wine project and ...
,
Wine
Wine is an alcoholic drink typically made from fermented grapes. Yeast consumes the sugar in the grapes and converts it to ethanol and carbon dioxide, releasing heat in the process. Different varieties of grapes and strains of yeasts are m ...
front-ends
*
PsychoPy
PsychoPy is an open source software package written in the Python programming language primarily for use in neuroscience and experimental psychology research. Developed initially as a Python library and then as an application with a graphical in ...
, experiment creation tool for neuroscience and psychology research
References
Citations
Sources
*
Further reading
*
External links
*
wxPython Widget Tutorial SeriesProject Phoenix main pageList of applications developed with wxPython
{{DEFAULTSORT:Wxpython
1998 software
Free computer libraries
Python (programming language) libraries
Widget toolkits
WxWidgets