ArticleslgStudy

computer science

WxPython

WxPython is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand WxPython rather than just read about it. In short: 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.

WxPython — main illustration
WxPython — illustration

Key takeaways

  • WxPython belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect WxPython to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of WxPython from memory before moving on to harder problems.

Reference excerpt

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 Python extension module (native code).

History In 1995, Robin Dunn needed a GUI application to be deployed on HP-UX systems but also run Windows 3.1 within short time frame. He needed a cross-platform solution. While evaluating free and commercial solutions, he ran across Python 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 the 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 applications requiring very little, if any, platform-specific code.

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.

This is another example of the wxPython Close Button with wxPython GUI display show in Windows 10 operating system.

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

Applications developed with wxPython Chandler, a personal information manager Dropbox, desktop client for the Dropbox cloud-based storage Editra, a multi-platform text editor Google Drive, desktop client for the Google cloud-based storage system 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

Sources

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

Official website wxPython Widget Tutorial Series Project Phoenix main page List of applications developed with wxPython

Illustrations

WxPython illustration
WxPython: Close button with wxPython shown on Windows 10
Close button with wxPython shown on Windows 10

Worked examples

Example 1 — a first encounter with WxPython

Start with the simplest possible case. Write down what WxPython claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to WxPython before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about WxPython ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of WxPython

In research
WxPython appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses WxPython in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
WxPython is common in secondary-school and first-year university syllabi. It links to neighbouring topics 1998 software, Free computer libraries, Python (programming language) libraries, so understanding it makes those chapters shorter.
In everyday life
Look for WxPython outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “WxPython” →

How to study WxPython in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what WxPython means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain WxPython out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is WxPython in simple terms?

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.

Why does WxPython matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study WxPython?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on WxPython.

Tags

  • 1998 software
  • Free computer libraries
  • Python (programming language) libraries
  • Widget toolkits
  • WxWidgets

Keep exploring