WxPython

WxPython

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. Like wxWidgets, wxPython is free software.

License

Being a wrapper, wxPython uses the same free software licence used by wxWidgets (LGPL) —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. 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 [ [http://groups.yahoo.com/group/python-announce-list/message/95 Yahoo! Groups ] ] .

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, 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, "Hello, World!", 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() app.MainLoop()

See also

* wxGlade, a wxWidgets GUI designer that creates wxPython code

External links

* [http://wxpython.org/ The official wxPython website]
* [http://wxwidgets.org/ The official wxWidgets website]
* [http://wiki.wxpython.org/wxPythonPit%20Apps List of applications developed with wxPython]
* [http://showmedo.com/videos/series?name=PythonWxPythonBeginnersSeries Tutorial screencasts for starting wxPython programming]
*
*

References

*


Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • WxPython — ist ein Wrapper des wxWidgets GUI Toolkits für die Programmiersprache Python. Die Syntax ist fast identisch mit der C++ Version. wxPython stellt eine Alternative zu Tkinter dar, das zum Pythonpaket gehört und auf der Tk API basiert. Wie Python… …   Deutsch Wikipedia

  • WxPython — Saltar a navegación, búsqueda wxPython …   Wikipedia Español

  • wxPython — ? …   Wikipedia Español

  • wxPython — ist ein Wrapper des wxWidgets GUI Toolkits für die Programmiersprache Python. Die Syntax ist fast identisch mit der C++ Version. wxPython stellt eine Alternative zu Tkinter dar, das zum Pythonpaket gehört und auf der Tk API basiert. Wie Python… …   Deutsch Wikipedia

  • WxPython — logo de wxPython wxPython est une implémentation libre en Python de l interface de programmation wxWidgets. Cette bibliothèque Python est utilisée pour la création d interfaces graphiques, et est l alternative de Tkinter la plus utilisée.… …   Wikipédia en Français

  • WxWidgets — Dieser Artikel wurde auf der Qualitätssicherungsseite des Portals Freie Software eingetragen. Beteilige dich an der Diskussion und hilf mit, den Artikel zu verbessern. wxWidgets …   Deutsch Wikipedia

  • WxWindows — Dieser Artikel wurde auf der Qualitätssicherungsseite des Portals Freie Software eingetragen. Beteilige dich an der Diskussion und hilf mit, den Artikel zu verbessern. wxWidgets …   Deutsch Wikipedia

  • Wxwidgets — Dieser Artikel wurde auf der Qualitätssicherungsseite des Portals Freie Software eingetragen. Beteilige dich an der Diskussion und hilf mit, den Artikel zu verbessern. wxWidgets …   Deutsch Wikipedia

  • Wxwindows — Dieser Artikel wurde auf der Qualitätssicherungsseite des Portals Freie Software eingetragen. Beteilige dich an der Diskussion und hilf mit, den Artikel zu verbessern. wxWidgets …   Deutsch Wikipedia

  • wxWidgets — Тип библиотека элементов интерфейса (виджетов) Разработчик …   Википедия

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”