Considerations when choosing a GUI package

原创 2004年07月05日 19:26:00

As we have seen, there are quite a few ways to build a GUI in Python and in some cases a choice is difficult. How, for instance, can you choose among Tk, wxWindows, FLTK or FOX if you do not have knowledge or experience in them? Well, before you make a choice you should have a look at each of them in any case. And you should check the following issues: <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

  1. The number of widgets. Well, if they are ugly or unnecessarily numerous, you will not be satisfied. But a diversity of good looking and functional widgets will help you design a good interface, especially if you are not a GUI designer.

  2. Look. It is very important nowadays to allow an application to look exactly according to the current theme of the operationg system, including widgets that do not exist on a particular OS.

  3. For some projects it may also be important to change the look-&-feel of the application when changing the theme of the OS.

  4. It is also 'in' to be able to create your own look-&-feel

  5. It is important to be able to create your own components.
    If you need, see whether you can create your own windows or use transparent screen areas.

  6. See if widgets provide transparency and layering.

  7. See if it is possible to locate widgets both absolutely and relatively.

  8. See if zooming is supported. I do not know of any GUI library for Python that does

  9. See if the image formats you work with are supported. I recommend to check out PNG because it is compressed, transparent, interlacing, animateable and supported by the Internet Explorer.

  10. Look at the geometry capabilities. It may sound weird but the most important geometric figure is a dot. Some packages provide you with lines, circles and what not but when you wish to draw whatever you wish, you often need just a dot :). It may be specially true if you wish to go into charting.

  11. Text and language issues:

  • Internationalization:

    • Unicode

    • Locales. Locale is a convenient tool bacause besides the language you can specify the time, monetary and other options.

  • Some GUI libraries offer you good text components in which you can show formatted text.
    Some even go further and allow you show text directly in the common formats (HTML, rtf, pdf, doc)


  • Ability to use any other widget as a cell.

  • Speed. Grids can work slowly with large data chunks.

Cross platform compatibility may be important to you. There are three issues:

  • Does it cover all the platforms you need

  • Does it really look fine on all platforms:

    • when you do not define a specific look-&-feel and your application uses the OS l&f

    • when you use a certain l&f

  • You write one code and do not go into the OS specifics

Separation between data and presentation. It is particularly convenient when your GUI is based on some changing data.

Check the license

How popular the library is. The more popular it is the more chances there are that it will not vanish tomorrow morning. For example, Tk IS popular. wxWindows is also popular because many people out there consider it to be better than Tk. But who can compare with GTK+ which is a part of such projects as GNOME and GIMP?!

Who stands behind the library. It is very important to know that the development of the library you use will continue for as long as you need.

Open source or proprietary? It is good when a rich company stands behind a libary. But they can grab you by the ... .
Open source is theoretically unreliable from many aspects but in practice it is the best because the best brains stand behind it.

There are also other, I call them traditional, considerations such as speed, memory use, multithreading and many others but the packages listed above are good. In any case, if you know of some theoretical problem that may come up, test it. For example if you are writing an image browser, load a hundred PSD thumbs into a slider and see if it stands the pressure.

Comparison chart of all the packages listed here - UNDER CONSTRUCTION
It is going to be a table with the following paramaters for comparison:

  1. Shell: whether it is performed as you type (like Python, Tk, DOS etc)

  2. Widgets: number and usefulness

  3. Native fook-&-leel issues

  4. Realtime theme change

  5. Custom l&f

  6. Transparent top level windows

  7. Absolute layout

  8. Relative layout

  9. Supported image formats

  10. Localization

  11. Unicode and internationalization

  12. Data structures and graphical widget for supporting formatted text

  13. Text Formats: HTML, RTF, XML etc

  14. Grid support

  15. Platforms

  16. View-Model Architecture

  17. License type

  18. Used in Longliving Projects (QT in KDE, GTK in GIMP etc)

  19. Who is the developer

Creating your own GUI package
The most ideal situation would be if Python had at least the most primitive commands for windowing systems.
The problem is that there are at least three differently built systems: Windows, X, Mac and why learn how to program them if someone else already did. That's what I think thought Guido van Rossum the Father of Python. He began with the Tk GUI library. As this page shows, many more GUI libraries followed. But how?! Python has a C extention mechanism. So, if some C++ GUI library has objects: Window, Button, Canvas it is possible to call these objects from Python. This leads to the situation when each of the numerous C GUI libraries must have its own wrapper in Python. But don't we live in the crosseverything compatibility age?! Wouldn't it be great to write one GUI package in Python and let developers decide what C GUI libraries they wish to use underneath. And this, in turn, leads to the AnyGUI situation when AnyGUI.Window is implemented by PyToSomeCLibWrapper.Window. In this respect AnyGUI is just like Java AWT. For those of you who do not know, such a solution did not work for Java.
The next stage of Python GUI packages should be the Swing stage of Java when there is preferably but not necessarily one native object that does all the drawing and all the actual widgets should be drawn dot by dot in Python. For example a Button object of such a package would have a draw method whose code would be a dot by dot, line by line description of the button and when it's time to show a GUI on the screen, one native object would draw it. In this case it is also possible to use the core of the already existing C GUI libraries but the quality of GUI programing in Python would climb another level just as it did in Java. Of course there will be problems too. The major problem is the bulk of memory such code would occupy and the result of it can be low speed. But Java overcame it by good design, VM speed and the speed of the present day hardware.
An example of such approach to Python GUI packages is the above mentioned Python GUI package.
It is important for me to note that I do not criticize the existing GUI wrappers. First of all, it is really better not to insert graphic commands into the interpreter if there are ready means. Second, Python is, hopefully, unpoliticized language and it gives access to the toolkit of your choice.
What concerns AnyGUI...they should have learned from AWT on the one hand, and it is still a good intermediate means.
What I think about the future... I think that either Python GUI will prevail, or AnyGUI will be rearchitectured to resemble Python GUI, or someone will develop something like Python GUI. I also think it's a pity to waste to for development of such packages as Tix. Tix a either politics or the result of the weak character of those who are ready to put up with the defaultness of Tk.

哈佛公开课《Positive Psychology 1504》学习笔记 -- FOCUS

1    Focus 1.1    Focus create reality 1.1.1    NOTES 1.    Happiness is not contingent on our st...
  • Smilings
  • Smilings
  • 2012-04-02 13:35:22
  • 2870

解决:QWidget: Cannot create a QWidget when no GUI is being used 程序异常结束

刚开始学Qt,用Qt creator控制台编写了一个小程序,编译时没有错误,结果执行时提示QWidget: Cannot create a QWidget when no GUI is being u...
  • qz18292003158
  • qz18292003158
  • 2015-07-10 18:07:59
  • 583

Understanding the Bias-Variance Tradeoff (理解偏差-方差权衡)

引言如果你想深入地理解偏差-方差,这篇文章再好不过了。我转载自Understanding the Bias-Variance Tradeoff,Trust me,这绝对是你不想错过的文章。如果你的网络...
  • xlinsist
  • xlinsist
  • 2016-07-12 21:36:05
  • 1446

解决QWidget: Cannot create a QWidget when no GUI is being used

长时间不用Qt了,新建了个控制台工程再添加自己的类,即是不想使用designer来设计自己的界面,编译时没有错误,执行时出现QWidget: Cannot create a QWidget when ...
  • muyuyuzhong
  • muyuyuzhong
  • 2011-12-02 11:24:52
  • 6860

QWidget: Cannot create a QWidget when no GUI is being used

使用vs当创建Qt Console Application来调用Qt的dll(含有gui界面)时,在Console Project Wizard应把GUI library选择上,当运行程序时出现: Q...
  • dotadage
  • dotadage
  • 2015-07-13 09:06:38
  • 922

Qt错误:QWidget: Cannot create a QWidget when no GUI is being used

运行Qt控制台应用程序时,出现错误: QWidget: Cannot create a QWidget when no GUI is being used 错误原因:控制台应用程序的管理是用QCo...
  • lyapple2008
  • lyapple2008
  • 2012-09-12 18:23:39
  • 256


第70讲:Scala界面GUI编程实战详解 学习笔记: 实际编程时有一个重要框架:akka。akka封装了actor。 scala作界面 开发时有一个库,提供了java的swing的封装...
  • slq1023
  • slq1023
  • 2015-07-28 21:38:00
  • 1051


LoadBalancerAutoConfiguration 定制个性化的restTemplate //定制个性化 restTemplate @Bean public SmartIniti...
  • csdn_ygy
  • csdn_ygy
  • 2017-09-15 10:21:24
  • 226

Week9_1Anomaly Detection

Week9_1Anomaly Detection Week9_1Anomaly Detection 第 1 题 第 2 题 第 3 题 第 4 题 第 5 题 第 1 题...
  • wangcong02345
  • wangcong02345
  • 2018-02-25 10:57:19
  • 91

B. Choosing Laptop

time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...
  • jj12345jj198999
  • jj12345jj198999
  • 2013-07-03 18:37:56
  • 895
您举报文章:Considerations when choosing a GUI package