Author: Jiangnan Baiyi
I have fully experienced the benefits of knowledge reuse. I was not familiar with Python and wxWidgets. I have already created a semi-finished desktop program in the dark.
1. Type Selection
After the model selection, people will urgently tell others why they think they are correct. At this time, people passing by will be more unfortunate.
I chose Python and wxWidgets because .......
Because it is a small program released to the Internet, it is very small, Java and. net, these two are still popular, but the stupid guy who wants to install virtual machines is out first, and python is 3 m after being compressed into RAR after py2exe. If you have the mind, you can make it smaller.
WxWidgets is selected because it can pass through Windows and Linux, and Fox can also be used. However, wxWidgets uses native widgets like SWT, which looks nice on WINXP.
Python rather than C ++ is used for rapid development. Of course, it is actually greedy and fun. The syntax that I liked Ruby is more pure. Unfortunately, wxruby has not been updated for too long.
2. wxWidgets
The so-called GUI framework is inseparable from the following points:
1. Framework Structure
With a helloworld, you can understand the Standard Architecture of application-> frame-> menu.
2. wxWidgets usage
After downloading the samples file, the C ++ API manual and the python DEMO code of each widgets are available.
3. Controls and layout of pages
One way is to generate components and layout in the program like C # winform and swing. It has experienced the torture of drawing pages with SWT handwriting code, then we can see that the container code (sizer in wxWidgets) is no longer troublesome. It is also known that the obtained tool is like BOA, but it is not as good as Visual Studio for winform and is difficult to use.
One is to write controls and layout in XML files like Delphi, Vc, or future XAML. But I am useless.
4. Event distribution mechanism
Code such as evt_button (self, id_upload, self. onupload) is quite simple.
It can be seen that wxWidgets is easy to learn as long as you have experience in Gui programming.
Reference: cross-platform GUI programming with wxWidgets
Wxpython in action
3. Python
Put a python reference book at hand, as long as you have a certain understanding of the dynamic language, can guess the sample code can guess, can not guess to get the CHM version of the reference book to index, it is easy to get started.
The most difficult thing is to traverse the directory. At that time, it was a bit difficult:
For root, dirs, files in OS. Walk ('C:/projects /'):
Print sum (getsize (join (root, name) for name in files)
What the hell's the syntax !!
The original OS. Walk ('C:/Projects ") returns a tuple. I have touched this concept in the C ++ boost library. Normal Functions can return only one value, however, tuple allows you to return multiple (so you don't need to use the address-passing parameter to return), so you have the for root, Dir, files in OS. a sentence like walk.
There is also print join (root, name) for name in files. In python, there is also a shorthand Method for writing closures in front of.
IDE finally uses the Eclipse plug-in pydev. After all, eclipse looks quite comfortable, and other editors are so ugly. How can they help collect money.
4. Beautify the interface
WxWidgets uses native Widgets. Unlike Delphi, C # And swing have special look and feel beautification controls. Therefore, the main method of beautification is to configure the toolbar and button with nice-looking icons, it also modifies the color of the entire software.
I recommend a tango icon Library: http://tango-project.org/to make open source software beautiful... said my heart, "top programmers have a tendency to be perfectionist artist. ", There are not many icons currently, and it is being updated quickly.