Pular para o conteúdo

Conheça Walt Disney World

wxPython

WxPython
WxPython-logo.png
Developer(s) Robin Dunn
Harri Pasanen
Stable release 2.8.12.1 / July 23, 2011; 8 months ago (2011-07-23)
Preview release 2.9.2.1 / July 23, 2011; 8 months ago (2011-07-23)
Development status Active
Written in C++ / Python
Operating system Cross-platform
License wxWindows License
Website wxpython.org

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, which is bundled with Python. It is implemented as a Python extension module (native code). Other popular alternatives are PyGTK and PyQt. Like wxWidgets, wxPython is free software.

Contents

License

Being a wrapper, wxPython uses the same free software licence used by wxWidgets (wxWindows License)[1]—which is approved by Free Software Foundation and Open Source Initiative.

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. 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]

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 python
 
import wx
 
class TestFrame(wx.Frame):
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, wx.ID_ANY, title=title)
        text = wx.StaticText(self, label="Hello, world!")
 
app = wx.App(redirect=False)
frame = TestFrame(None, "Hello, world!")
frame.Show()
app.MainLoop()

Applications Developed with wxPython

See also

  • wxGlade, a wxWidgets GUI designer that creates wxPython code
  • wxWidgets, a popular C++ GUI toolkit that wxPython uses as its framework
  • XRCed, an XML tool for wxPython GUI design

References

Notes
Bibliography
  • Rappin, Noel; Dunn, Robin (March 1, 2006). wxPython in Action. Greenwich: Manning Publications. pp. 552. ISBN 978-1932394627. 

Further reading

  • Precord, Cody (December 2010). wxPython 2.8 Application Development Cookbook. Greenwich: Packt Publishing. pp. 308. ISBN 978-1849511780. 

External links

Personal tools
  • Log in / create account
Namespaces

Variants
Actions
Navigation
Toolbox
Print/export