WxPython
From Wikipedia, the free encyclopedia
- The correct title of this article is wxPython. The initial letter is shown capitalized due to technical restrictions.
wxPython is a cross-platform wrapper for the 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, which is bundled with Python. It is implemented as a Python extension module (native code). Other popular alternatives are PyGTK and PyQT
Contents |
[edit] License
Being a wrapper, the license is the same as wxWidgets, which uses the wxWindows license[1]> (approved by the Open Source Initiative. Another license was submitted under the 'wxWidgets' name and is currently pending approval.
[edit] History
wxPython was born when Robin Dunn needed a GUI to be deployed on HP-UX systems and also on Windows 3.1 in a few weeks time. While evaluating commercial solutions, he ran across Python bindings for the wxWidgets toolkit. Thus, he learned Python and, in a short time, became one of the main developers of wxPython (which grew from those initial bindings), together with Harri Pasanen. The first versions of the wrapper were created by hand. However, soon the code base became very difficult to maintain and keep in sync with wxWidgets releases . However, later versions were created with SWIG, greatly decreasing the amount of work to update the wrapper. The first "modern" version was announced in 1998[2].
[edit] Example
# -*- coding: utf-8 -*- import wx class TestFrame(wx.Frame): def __init__(self, parent, ID, title): wx.Frame.__init__(self, parent, -1, title, pos=(0, 0), size=(320, 240)) panel = wx.Panel(self, -1) text = wx.StaticText(panel, -1, "Test", wx.Point(10, 5), wx.Size(-1, -1)) class TestApp(wx.App): def OnInit(self): frame = TestFrame(None, -1, "Hello, world!") self.SetTopWindow(frame) frame.Show(True) return True if __name__ == '__main__': app = TestApp(0) app.MainLoop()
[edit] See Also
- wxGlade - a wxWidgets GUI designer that creates wxPython code
[edit] External links
- The official wxPython website
- The official wxWidgets website
- Tutorial screencasts for starting wxPython programming
- wxWidgets Licence. Retrieved on January 16, 2007.
- wxPython 0.3 announcement on Yahoo Groups. Retrieved on January 16, 2007.
[edit] References
- Noel Rappin, Robin Dunn,. wxPython in Action. Greenwich, CT: Manning Publications. ISBN 1-932394-62-1.