Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×

WxPython in Action 77

aceydacey writes ""WxPython in Action" is a new and definitive guide to the popular wxPython GUI framework. WxPython has been growing in popularity by leaps and bounds in recent years but has been hampered by a comparative lack of good, comprehensive documentation, so much so that many people have turned to studying the documentation for the underlying wxWidgets framework, that is written in C++. "WxPython in Action" fills the void by combining a good introduction to the framework with a comprehensive and accessible reference document. At 552 pages, Manning Publications has produced a definitive book." Read the rest of Ron's review.
WxPython in Action
author Robin Dunn and Noel Rappin
pages 552
publisher Manning
rating 10
reviewer Ron Stephens
ISBN 1-932394-62-1
summary An introduction to the WxPython GUI Framework


WxPython is one of the best cross-platform GUI toolkits for the open source Python programming language. It excels in matching the native look and feel of programs on Windows, Linux, and Mac OS X. It is a mature project, being a well-developed wrapper of the underlying wxWidgets C++ toolkit. Another reason for its growing popularity is its very extensive number of widgets, making it a capable and modern tool for making professional-looking GUIs for applications in almost any field of endeavor. It has endured a reputation for having a steep learning curve, and for sometimes being difficult to install and easy to break during upgrades; both of which downsides should be lessened by the publishing of this book.

Written by Robin Dunn, the creator and moving force behind wxPython, and ably assisted by Noel Rappin, this book is definitive, authoritative and well-written. Part 1 fills the role of a good introduction to the toolkit, and Parts 2 and 3 are a thorough reference to the widgets, behavior and usage of the framework.

in Part 1, we learn the inside story behind the beginnings and the history of wxPython's development. We are walked through the creation of simple examples of the core functionality of the framework illustrating how to create and use the basic controls and event loops. Then, we get a more detailed explanation of the wxPython event loop, an introduction to PyCrust (a useful tool for wxPython programmers, essentially an interactive interpreter session, wrapped as a wx widget) a whole chapter on the Model-View-Controller paradigm, and a discourse on good factoring techniques for GUI programs. This is rather general programming knowledge, not necessarily specific to wxPython, and truly expert programmers will probably skip much of this material, but for many, like me, it is very useful, and for many others, it will be a good review of previously known material. The writing style is excellent but one weakness is that the authors return again and again to wxPython evangelism and boosterism, which is regrettable; but this is the only section of the book to suffer from this flaw.

Part 2 gives detailed coverage of each widget, control, frame, dialog, and menu in the toolkit, and this is the meat of the book and will be used and reused as core reference material by many a programmer. This is good stuff, thorough, well researched, and definitive. Next, the authors give an equally good explanation of how to use sizers and grids to layout and control your GUI application. Part 2 fills the previously missing gap in core wxPython documentation and, to folks who need it, is worth its weight in gold.

Part 3, called Advanced wxPython, gives welcome coverage to advanced layout and control issues. This subject of advanced layout is, in my opinion, where the rubber really hits the road in GUI design, and it is appropriate that this is where the authors spend the most time and effort, and with good result. The final chapter breaks new ground by walking the reader through the creation of a multithreaded wxPython application. This is great stuff, and the advanced readers will be left pining for even more on this timely topic of such growing importance. Fortunately, the authors are available online to communicate with users who truly master the material in the book and want to to pursue more advanced usage.

The book is at its best in documenting the core API for expert programmers who are new to wxPython. It is also a good introduction to wxPython for advanced programmers. For moderately experienced programmers, the book is excellent but will be a tough read; probably not to be mastered in a straight read thorough, the book will adequately reward this kind of reader who is dedicated and persistent. For novice programmers, especially those who have little to no previous experience in GUI programming, I believe the book may be beyond their grasp.

So, if you are a serious programmer who wants or needs to use the wxPython GUI toolkit, "wxPython in Action" is a must-have reference book. It is perfect for this kind of reader and will become a well-worn book that will be useful for at least the next five years. It is unlikely that any other book about wxPython will be published that could do a better job, given the authors' unparalleled understanding of the toolkit and the obvious patience, time and care they took in researching, writing, and editing this book. It is not a casual read, but to a serious student of the subject, that is a positive statement. The book is strong meat, a weighty and substantive technical tome.

The book really shines in the many pages devoted to User Interface design and implementation. This is where many programmers need help, and it is gratifying that this book goes into the most detail on this subject. This is very detailed coverage and one is left with a satisfaction that, while not easy reading, it is well worth while. I feel this is the book's strongest point.

I know that it sometimes seems there has been an inflation in the scoring of books, with reviewers giving so many high ratings that one wonders how meaningful those ratings are. This book is not for everybody, and it is not a work of great literature, but given the obvious need for such a work, and the careful and accurate fulfillment of this need by these authors, I feel justified in giving it a rating of ten stars. For the people who really need this book, it is about as good as it could get, and will be a most welcome addition to their technical library.

More material for those learning and using Python can found at my web site Python Learning Resources.


You can purchase WxPython in Action from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
This discussion has been archived. No new comments can be posted.

WxPython in Action

Comments Filter:
  • Comment removed (Score:4, Informative)

    by account_deleted ( 4530225 ) on Monday July 10, 2006 @04:27PM (#15693549)
    Comment removed based on user account deletion
  • by rabalde ( 86868 ) on Monday July 10, 2006 @04:29PM (#15693567) Homepage
    ... wxPython [wxpython.org], "a blending of the wxWidgets C++ class library [wxwidgets.org] with the Python programming language [python.org]". Please, do not forget to put links on the articles, because the /. effect need'em.
  • by Anonymous Coward on Monday July 10, 2006 @04:34PM (#15693606)
    Not really. Nearly all GUI toolkits allow putting the widgets outside of the GL Canvas, but what you speak of would involve mucking with way too much evil. Essentially you can get the bitmap for any active window in WX, but mapping the event models back and forth would require some extreme skill -- and quite a performance hit. You'd have to manipulate the wx API programatically and do all the mapping translations yourself.

    That being said, wxPython rocks. I wrote wxPython code for a living for about a year and came away with a great respect for it. Printers and the like ... they all work. I didn't bother with the socket/thread stuff since Python can do that, but in all it's pretty nice. Layout was a bit annoying, but not nearly as bad as Swing. My advice... write all your code programatically using sizers and don't use the glade-like editor at all.
  • by Ursus Maximus ( 540370 ) on Monday July 10, 2006 @04:36PM (#15693618) Homepage
    Wax is a user-friendly layer on top of wxPython. It allows for easier GUI programming in a more "Pythonic" way. It runs on all platforms that support wxPython. It can be found aand downloaded at http://sourceforge.net/projects/waxgui [sourceforge.net]
  • Plug-ins (Score:3, Informative)

    by truthsearch ( 249536 ) on Monday July 10, 2006 @04:52PM (#15693730) Homepage Journal
    The one place where using the python wrapper for wxWidgets can really pay off is user scripting or plug-ins. If your app's written in python it's quite easy to allow users to write plug-ins to your app in python. Otherwise you'd have to connect your C++ app to the python interpreter to give the same ability.

    I used wxPython for a while because I think it's a great alternative to VB. Coming from the VB world it was a big step up with a small learning curve. It's a good way for Windows desktop developers to get into Linux desktop development.
  • Re:About time (Score:4, Informative)

    by WoLpH ( 699064 ) on Monday July 10, 2006 @04:55PM (#15693744)
    Another (imho pretty good) alternative, PyQT [riverbankcomputing.co.uk].

    Using the QT widgets it's cross platform (Linux, BSD, Windows, others?) and pretty fast :)
  • And PyGlade (Score:2, Informative)

    by malverian ( 563649 ) on Monday July 10, 2006 @05:18PM (#15693904) Homepage
    Combining PyGtk and PyGlade is one of the most amazing user interface programming experiences I've ever had. That is to say, it's not completely unbearable. My favorite feature by far is that if you have a class (let's call it "InterfaceSignals"), you can call signal_autoconnect(InterfaceSignals) to automagically connect every method in that class to the respective signals defined in your Glade file, due to Pythons wonderfully introspective nature.

    Also, unlike wxPython, pyGtk actually has very nice documentation. For reference, here's the signal_autoconnect method I mentioned:
    http://www.pygtk.org/pygtk2reference/class-gladexm l.html#method-gladexml--signal-autoconnect [pygtk.org]
  • Re:Nice, but... (Score:2, Informative)

    by paulli ( 259692 ) on Monday July 10, 2006 @05:41PM (#15694035)
    http://users.skynet.be/saw/wxJS/ [skynet.be] for javascript.

    This assumes you are using javascript as a programming language and not hacking out a web page.
  • by pnot ( 96038 ) on Monday July 10, 2006 @06:00PM (#15694163)
    Please provide a link to the well-documented free toolkit from a big company that runs on Linux.

    Qt [trolltech.com] from Trolltech [trolltech.com] is Free [trolltech.com], extremely well-documented [trolltech.com], and runs on Linux and several Unix flavours [trolltech.com] as well as Mac OS X and Windows.
  • by Mitchell Mebane ( 594797 ) on Monday July 10, 2006 @06:02PM (#15694175) Homepage Journal
    wxWidgets linux does NOT use Qt, it uses GTK. As I understand it, wxWidgets is LGPL and Qt is GPL, and writing a Qt backend would force it to be GPL. :/
  • by AWhiteFlame ( 928642 ) on Monday July 10, 2006 @06:29PM (#15694339) Homepage
    wxWidgets is not LGPL. wxWidgets is under the wxWindows (the project was renamed but apparently this wasn't) license.
  • by Duke ( 23059 ) on Monday July 10, 2006 @08:36PM (#15694995)
    And PyQt http://www.riverbankcomputing.co.uk/pyqt/ [riverbankcomputing.co.uk] http://www.diotavelli.net/PyQtWiki [diotavelli.net] is the Python wrapper. There is a book http://www.valdyas.org/python/book.html [valdyas.org] that is quite good.
  • by MrBlic ( 27241 ) on Tuesday July 11, 2006 @08:08AM (#15696991) Homepage
    Having used wxPython for just a few small projects, and currently one very large one, I found that the book was appropriate for someone who was just getting started. WxWidgets and wxPython can do much more than this book would suggest.

    I keep it on my bookshelf next to the wxWidgets book [amazon.com] and end up reaching for the wxWidgets book more often, even though I'm using wxPython.

    I agree with the other poster who suggests that people code GUIs with sizers instead of using the XRC resources, although if you have multiple people on a project, and one or two want to change just the GUI, then the XRC, along with Dialog Blocks [anthemion.co.uk] would be a perfect combination. The trick to making the gui stuff quick even though it's in code is to configure your favorite text editor with snippets or aliases or whatever it calls them to have lots of fill-in the blanks templates for things like a staticText / Edit box row in a dialog. I have a good collection of VisualSlickedit aliases I'd be happy to send to anyone who e-mails me at: jim at maplesong dot com.

    wxPython is easy to debug too. I'm coding my application partially in C++ wxWidgets, and driving the complex gui parts in wxPython. I have my wxPython extension dll in a visual studio project, and I point the "when debugging run:" to python itself, with an argument that points to my script. I can set breakpoints in my C++ code, and they are hit when I get to the right place in the wxPython gui. I can simutaneously use Wing IDE [wingware.com] from Wingware to debug the python code. The trick is the python actually initiates the conversation with the debugger through sockets... the debugger just has to be in 'passive mode' to accept the connection.

    Unlike the other posters, I have not run into anything buggy. Everything has been solid, and has made sense, and for the most part worked the first time every time, even mostly on OSX. (I start off on Windows.) The only troule I've had on Linux/GTK is controlling the font size in the HTML windows. (wxWidgets has a simple but fantastically useful lightweight HTML layout widget!)

    I'm really hoping that Google comes around to putting some support into wxWidgets & wxPython. It already has great support from Mitch Kaypor and the OSAF [osafoundation.org], and AOL has used it for their communicator, and lots and lots of small shops have used it successfully, as well as several open source projects... Ok, it's doing fine.

    -Jim

"The one charm of marriage is that it makes a life of deception a neccessity." - Oscar Wilde

Working...