How to learn WxPython

Source: Internet
Author: User
Tags wxwidgets

Directory

    1. How to learn WxPython
      1. Learn Python
      2. Choose a good editor
      3. Install WxPython
      4. Read The WxPython Tutorials
      5. Read the WxPython Style Guide
      6. Read the demo files
      7. Use the WxWidgets documentation
      8. Use the WxPython Reference (experimental)
      9. Study Other people ' s code
      10. Ask questions!

We have had a lot of questions on the newsgroup asking what to go about learning WxPython. This page gives some pointers on how to do just.

Learn Python

If you is new to Python, and especially if is new to programming in general, it makes the most sense to learn Python First, without any GUI stuff. The wait can be frustrating, but it's worth it. Python is a very powerful language capable of doing many things both with and without GUIs.

At a minimum, you should understand topics such as functions, modules, and classes. Without those, learning WxPython would be a frustrating experience. The Python website has a excellent guide for beginners so takes you step-by-step through the process of learning the LA Nguage. http://www.python.org/about/gettingstarted/

Choose a good editor

Features such as Auto-completion, code highlighting, and an interactive window make to faster programming with less error S.

See http://wiki.python.org/moin/PythonEditors for a list of editors.

Install WxPython

If you don ' t already has WxPython installed, see the Do to install WxPython page.

Read The WxPython Tutorials

Wiki Tutorials: A Great Place-to-start is the Getting Started page. Then your should look at the obstacle Course and the Fully functional Demo.

External Tutorial: Another great resource is the Zetcode WxPython tutorial. It covers using a wide range of subjects, including:getting started, Menus/toolbars, Sizers, events, the drawing API, wid Gets, creating custom widgets and demonstrates several ' skeleton ' applications.

Video Tutorials: showmedo.com hosts a set of WxPython tutorial videos-excellent for beginners. There is also a series of WxPython videos on YouTube.

Read the WxPython Style Guide

It'll serve you the use a nice, modern style for your WxPython code. Due to API changes over the years, and just plain experience, WxPython code style have changed quite a bit over the years, And gotten much more pythonic.

Unfortunately, a lot of the examples you ' ll find has not been updated to reflect this style. As you'll benefit from the using good, modern, style, make sure to study WxPython style guide right when you get started, to Establish good habits.

Read the demo files

WxPython comes with a comprehensive set of demos and examples. Go to the download page and scroll the wxpython-demo-x.x.x files. The demo demonstrates nearly all the features of WxPython. You can see how different features work and study the source code.

Note: If The Demos don ' t work, make sure you have the latest WxPython version installed. Sometimes demos use features not found in older versions. To check your WxPython version, run:

Toggle Line Number Display

   1 Import wx   2 print wx.version ()

A popular-to-work on WxPython are to find a demo it's close to what's want, copy it, and then alter it to fit your Needs. Another source of examples is the WxPython Cookbook.

Use the WxWidgets documentation

A very important resource is the wxWidgets documentation.

It's written mainly in C + +, but there be notes for WxPython and most of the time can mentally convert from the C + + s Yntax to the WxPython syntax. You don ' t need to know C + + to benefit from this. A lot of WxPython programmers don ' t know any C + + at all, and they still find the wxWidgets documentation very useful.

If you need help reading the WxWidgets docs, the C + + guide for Pythoneers might is of help. Or you can just ask for help on the mailing list.

Use the WxPython Reference (experimental)

You can try the automatically generated API reference. This was an experimental feature. It's not as thorough or mature as the wxWidgets documentation, but it's written in WxPython syntax instead of C + + syntax .

Study Other people ' s code

Charles Simonyi, the legendary Microsoft programmer, grew up in Hungary and had few books available to him from which to L Earn computer Science. He is able to get the source code for a compiler and studied the printouts as musicians would study musical scores.

There was quite a few gems in the sample code that was distributed with WxPython but was not in the Demo program, e.g., Fro GEdit and its underlying wx.lib.editor module. I had assumed that the editor would be a wx. Textctrl on steroids. I was surprised to see that the text is drawn to the screen using a DC (device control) and learned some good techniques. I am also "reading" Transana and Task Coach, ii sophisticated applications written in Python and WxPython, to learn how Large applications is structured. There is a huge difference between the small examples on this wiki, and actual real-world code, so the process of Analyzin G large applications is integral to learning WxPython.

Ask questions!

The Wxpython-users mailing list is famous for it helpful and friendly members. You can subscribe to it here:http://wxpython.org/maillist.php.

How to learn WxPython

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.