目录

  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 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相关推荐

  1. Python GUI界面开发软件综述

    参考致谢: 28款Python GUI开发框架开源软件 https://www.cnblogs.com/muziyunxuan/archive/2017/12/26/8117875.html Py之G ...

  2. python做桌面应用程序_Python如何实现图形化界面制作为桌面软件?

    我觉得这个问题提的有点不清楚,从两个角度理解吧. 1. Python图形化开发,我觉得第1个回答满对的,我再详细说说. 2. Python程序打包,其实是第2个回答的内容,少了平台的限定,如果只是wi ...

  3. wxPython官方文档翻译第一期初稿

    wxPyWiki的目的是为了提供软件文档.示例.使用方法等.是为了帮助人们学习.理解和使用wxPython. 注解:想了解更多关于wxPython的内容,可以点击这里. 这里有多种类型的可用信息.当前 ...

  4. Getting started with wxPython

    登录 Getting Started FrontPage RecentChanges FindPage HelpContents Getting Started 只读网页 信息 附件 更多操作:源码 ...

  5. 【Kaggle Learn】Python 1-4

    [Kaggle Learn]Python https://www.kaggle.com/learn/python 一. Hello, Python A quick introduction to Py ...

  6. python制作图形化界面_python图形化界面设计(wxpython)一布局管理

    本篇内容来自https://www.cnblogs.com/-wenli/p/12149850.html 1.布局分析和注意点 例程主要是Sizer布局应用.wx.BoxSizer的布局方向分为横向和 ...

  7. linux 窗口z order,wxPython窗口z-order设置

    使用wxpython写的界面程序其实也是可以设置Z-order的. 可以使用pywin32模块调用win32的API实现,使用方法不在赘述. 如果仅仅是想将窗口置顶(放在其他窗口上面,Z-order顶 ...

  8. Blender赛车动画制作学习教程 Learn Race Car Animation with Blender

    使用Blender 2.93创建您自己的惊人汽车动画 你会学到什么 Blender的界面和导航 建模 UV制图 材料 动画 照明设备 渲染 合成 要求 下载并安装Blender.免费下载和免费用于任何 ...

  9. Blender3.0动画制作入门学习教程 Learn Animation with Blender (2021)

    要求 下载并安装Blender.免费下载和免费用于任何目的. 描述 加入我的动画课程. 在本课程中,我将从头开始讲述在Blender中创建动画场景的过程. 从第一步到最终渲染.在这个课程中,我们将使用 ...

最新文章

  1. php中复选框删除数据_checkbox 删除,checkbox_PHP教程
  2. domain,DNS,冗余,DNS劫持的大致原理
  3. 10.递归是神马?recursion
  4. java docx4j 合并word_利用docx4j来处理word的合并与拆分
  5. 深度学习每层的通道数如何计算_深度学习基础系列(一)| 一文看懂用kersa构建模型的各层含义(掌握输出尺寸和可训练参数数量的计算方法)...
  6. Network | DNS
  7. React性能优化总结
  8. ngxin做http强制跳转https,接口的POST请求变成了GET
  9. Microsoft Virtual Lab Use Guide
  10. PAT Basic 1071. 小赌怡情(15)
  11. php商品详情显示页面代码,ecshop源码程序在购物车页面显示出商品的描述
  12. 基于python下django框架 实现旅游景区景点售票系统详细设计
  13. 流量宝刷流量怎么操作不会被搜索引擎惩罚
  14. Java校园语音通信软件开发
  15. library genesis (libgen)及Book系列网站的使用方法,外文图书下载神器,Springer学术书籍免费下载
  16. 基于ssm实验室管理系统mysql
  17. Windows的截屏键
  18. python绘制多个散点图_如何利用python把多个散点图画在一张图上:一个案例
  19. 19254:狙击战(二分答案)
  20. html手机偏左,判断方向盘跑偏有妙招 一部手机就搞定

热门文章

  1. Firefox自带下载功能进行断点续传
  2. 程序员如何精确评估开发时间?
  3. 老板:kill -9 的原理都不知道就敢去线上执行?明天不用来了
  4. Java当中的常量池
  5. Linux 还能这么玩,10 个非常有趣的命令!
  6. 一致 Hash 算法
  7. JVM:类加载机制之类加载过程
  8. 计算机网络 公有IP和私有IP介绍
  9. java 循环依赖_java – 如何在Gradle中解决循环依赖
  10. IT运维服务管理中知识