日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

How to learn wxPython

發布時間:2025/3/21 python 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 How to learn wxPython 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

目錄

  • How to learn wxPython
  • Learn Python
  • Choose a good editor
  • Install wxPython
  • Read the wxPython tutorials
  • Read the wxPython Style Guide
  • Read the demo files
  • Use the wxWidgets documentation
  • Use the wxPython reference (experimental)
  • Study other people's code
  • Ask questions!
  • We have had a lot of questions on the newsgroup asking how to go about learning wxPython. This page gives some pointers on how to do just that.

    Learn Python

    If you are new to Python, and especially if you are 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 is 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 will be a frustrating experience. The Python website has an excellent guide for beginners that takes you step-by-step through the process of learning the language. http://www.python.org/about/gettingstarted/

    Choose a good editor

    Features such as auto-completion, code highlighting, and an interactive window make for faster programming with less errors.

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

    Install wxPython

    If you don't already have wxPython installed, see the How to install wxPython page.

    Read the wxPython tutorials

    Wiki tutorials: A great place to start is the Getting Started page. Then you 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, widgets, 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 will serve you well to use a nice, modern style for your wxPython code. Due to API changes over the years, and just plain experience, wxPython code style has changed quite a bit over the years, and gotten much more Pythonic.

    Unfortunately, a lot of the examples you'll find have not been updated to reflect this style. As you will benefit from 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 down to 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:

    切換行號顯示

    1 import wx2 print wx.version()

    A popular way to work on wxPython is to find a demo that is close to what you 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 is written mainly in C++, but there are notes for wxPython and most of the time you can mentally convert from the C++ syntax 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 be 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 is an experimental feature. It is not as thorough or mature as the wxWidgets documentation, but it is 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 learn computer science. He was able to get the source code for a compiler and studied the printouts as musicians would study musical scores.

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

    Ask questions!

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

    轉載于:https://www.cnblogs.com/zhang-pengcheng/p/4855947.html

    總結

    以上是生活随笔為你收集整理的How to learn wxPython的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。