wxPython
Developer(s) | Robin Dunn Harri Pasanen |
---|---|
Initial release | 1998[1] |
Stable release | 4.1.1[2]
/ November 21, 2020 |
Repository | |
Written in | C++ / Python |
Operating system | Cross-platform |
License | wxWindows License |
Website | wxpython |
wxPython is a wrapper for the cross-platform GUI API (often referred to as a "toolkit") wxWidgets (which is written in C++) for the Python programming language. It is one of the alternatives to Tkinter. It is implemented as a (native code).
License[]
Being a wrapper, wxPython uses the same free software licence used by wxWidgets (wxWindows License)[3]—which is approved by Free Software Foundation and Open Source Initiative.
History[]
wxPython was created when Robin Dunn needed a GUI to be deployed on HP-UX systems and also on Windows 3.1 within a few weeks. While evaluating commercial solutions, he ran across Python bindings for the wxWidgets toolkit. Thus, he learned Python and, in a short time, together with , became one of the main developers of wxPython, which grew from those initial bindings.
The first versions of the wrapper were created by hand. However, soon the code base became very difficult to maintain and keep synchronized with wxWidgets releases. Later versions were created with SWIG, greatly decreasing the amount of work to update the wrapper. The first "modern" version was announced in 1998.[1]
Example[]
This is a simple "Hello world" 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()
Project Phoenix[]
Project Phoenix, which began in 2010, is an effort to clean up the wxPython implementation and in the process make it compatible with Python 3.[4] This project is a new implementation of wxPython, focused on improving speed, maintainability and extensibility. Just like "Classic" wxPython, it wraps the wxWidgets C++ toolkit and provides access to the user interface portions of the wx API, enabling Python applications to have a graphical user interface on Windows, Mac or Unix systems with a native look and feel and requiring very little, if any, platform-specific code.[5]
The current version, wxPython 4.x was released, starting from 2017, and is the current version being followed.
Applications developed with wxPython[]
- Chandler, a personal information manager
- Dropbox, desktop client for the Dropbox cloud-based storage[6]
- Editra, a multi-platform text editor
- Google Drive, desktop client for the Google cloud-based storage system[7]
- GRASS GIS, a free, open source geographical information system
- Métamorphose, a batch renamer
- Phatch, a photo batch processor
- PlayOnLinux and PlayOnMac, Wine front-ends
- PsychoPy, experiment creation tool for neuroscience and psychology research
References[]
Citations[]
- ^ a b "wxPython 0.3 announcement on Yahoo Groups". Retrieved 2007-01-16.
- ^ "wxPython Changelog". wxPython. 2020-11-21. Retrieved 2021-02-18.
- ^ "Copyright notice". Retrieved 2009-02-27.
- ^ "Goals of Project Phoenix". Retrieved 2016-03-17.
- ^ "Project Phoenix readme file on GitHub". Retrieved 2014-01-01.
- ^ "6 lessons from Dropbox one million files saved every 15 minutes".
- ^ "Open source components and licenses". Google. Retrieved 28 January 2013.
Sources[]
- Rappin, Noel; Dunn, Robin (March 1, 2006). wxPython in Action. Greenwich: Manning Publications. p. 552. ISBN 978-1-932394-62-7.
Further reading[]
- Precord, Cody (December 2010). wxPython 2.8 Application Development Cookbook. Greenwich: Packt Publishing. p. 308. ISBN 978-1-84951-178-0.
External links[]
Wikimedia Commons has media related to WxPython. |
- Official website
- wxPython Widget Tutorial Series
- Project Phoenix main page
- List of applications developed with wxPython
- 1998 software
- Free computer libraries
- Python (programming language) libraries
- Widget toolkits
- WxWidgets