开发者

Pros and cons of tkinter and wxWidgets?

I am reading this tutorial which is helping me learn both tkinter and wxWidgets para开发者_JAVA技巧llely, but I want to dig deep, so would like to know which GUI tool is better to learn in depth and why?


It's impossible to say which is "better". Either can be used for most common user interface tasks.

If I could somehow summarize in a sentence, I would be tempted to say that Tkinter is better designed and a little easier to use, but wxPython is more feature-rich and looks a little bit nicer.

tkinter pros: part of python, nothing extra to download. Very simple syntax. The text widget is remarkably powerful and very easy to work with. The canvas widget is also very easy and powerful. No other toolkit provides the same mix of ease and power than those two widgets in my experience. Uses native widgets on the mac and windows. Tk is rock solid with few cross-platform idiosyncrasies. I think Tkinter's binding mechanism is far superior to wxPython's; it's more flexible and consistent. I think Tkinter's three geometry managers - pack, place and grid - are much more powerful and easy to use than the wxPython sizers.

tkinter cons: Uses motif-like widgets on *nix boxes which many find off-puting (though some careful tweaks can make GUIs look perfectly acceptable). Sometimes hard to debug in that Tkinter widgets at their core aren't python objects; tkinter provides a wrapper around the actual tk widgets which sometimes means you get weird error messages. There is very little printing support (you can generate postscript docs from the canvas, but there's no built-in support in the text widget for printing). Some people claim Tk is ugly. Tkinter isn't as "pythonic" as wxPython.

wxpython pros: It has many more widgets, though often that means there are three types of notebook widgets rather than one kitchen-sink widget. wxPython widgets are first class python objects which is really nice. wxPython generally looks better on *nix machines. wxPython seems to be more popular; some people care about that, some don't. wxPython has much better printing support than Tkinter.

wxPython cons: wxPython requires a separate download which can be a pain to manage when you deploy your app. Documentation is very weak in my opinion; it's very hard to find specific information. "wPython in Action" book provides a good introduction but can't be relied on as a reference book. wxPython is a bit buggy IMO, and there are definite cross-platform issues. I've seen wxPython crash and print assertions way more often than Tkinter.


If you're new and looking to choose one, I HIGHLY recommend tkinter for it's simplicity and effectiveness. wxPython can wait until you have a very good understanding of python, particularly classes and GUI in general.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜