Cross Platform Desktop Applications (N. Yergler).notes

Thursday, March 24, 2005

TITLE OF PAPER: Cross Platform Desktop Applications with Python
PRESENTED BY: Nathan Yergler
REPRESENTING: Creative Commons

DATE: Wednesday, March 24, 2005
LOCATION: GWU Cafritz Conference Center, Marvin Theatre

{If you've contributed, add your name, e-mail & URL at the bottom}

Cross-platform = Mac OS X, Windows, Linux

Presenter introduced to Python in 2001; at CC since 2004


Why wxPython?
    Shared code base
    Native look and feel
    Developer familiarity
    "Not Tkinter" -- joke
    Mature (mostly)
        Robin Dunn working on OS X support

10000' view
    Application, Window, Model classes (do use a Model class)

You must overrider OnInit to perform application setup, and do a few
things listed in the slides

Top-Level Window
    2 major ways to develop UI in wxPython:
        Python-coded (by hand or with a tool like wxGlade)
   XRC allows you to maintain the UI definition independently

Sanity and X-plat XRC:
    Don't use GridBagSizer ever -- OS X issues, lots of other issues
    Remember static paths may change w/ StaticBitmap
    Use "magic" menu IDs when targetting OS X
    Create empty menu even if you don't need one (becomes top-level menu for OS X)

> OS X appears to be the platform with the most problems right now.

    Distutils provides the basic RPM/TGZ building methods.
    Need something a little more seamless for Win32 and OS X
    Two phases:
        building a distribution

Freezing: bundling Python and required libraries
    py2exe on Windows
    py2app on OS X

    Allows you to build multiple executables with a single pass
    Use the windows and consoles options to specify the primary script and
        (optionally) icons
    When using Unicode you need to explicitly include the encodings package
        (FAQ on the wxPython mailing list)
    WXS file -- MS open source project -- see wiki
Building distribution [Windows]
    Uses WiX (open source from Microsoft) to build MSI-based installers
    Two GUIDs: one global, one for each version of app
       How MS installer tracks upgrades
    Parts of the build can be automated:
       Generating new GUID
       Setting environment variables
    Python 2.4 requires VC 7 DLLs -- py2exe doesn't copy them over by default
        Licensing issue: can we bundle VC7 DLLs when distributing a
            wxPython app? Possible answer is that you are allowed to
            distribute it with VC apps and Python is a VC app.

py2app - OS X packager
    Replacement for bundlebuilder

Distributing on OS X:
    use diskimages
    Apple tool: hdiutil

Cross-platform is possible
    [apparently you need to test sys.platform]
    can specify "options" by platform/tool (i.e. for py2exe vs. py2app)
    options has py2exe and py2app options

Cross-platform Wishlist
    HigSizer [i.e. layout of controls conforming to platform's HIG]
        [claims he can get about 75% of the way there -- working on it]
    Python port for WiX
    Better way to handle arbitrary data in distutils scripts   
        Q: data installed with packages or in arbitrary locations?
        A: Arbitrary locations (I missed most of this answer --Brad)
    Variable substitution for XRC files

    Python good language for xplat apps
    Lots of tools available
        => scripts are your friends


Q: Compare wx vs. e.g. Swing? (especially w/r/t OS X?)
A: I wouldn't try to make Swing look right cross-platform; SWT from Eclipse
    probably better. We chose wx because we could control and bundle it;
    rejected Java in part due to issues with various JVMs. Getting layout
    right on OS X is the biggest frustration (e.g. explicit spacing vs.
    border properties).

Q: You mentioned Mac and Windows distributions. What about Linux?
A: Two different options.
      cxFreeze ..not good experience <he explained problems...didn't follow.>
      other option?

Q: plug for Boa Constructor, wx, pyCrust shell
A: Yeah, it's the Delphi of wx

Q: comment on tkinter vs. wx?
A: previous bias against tkinter (but may want to revisit); display issues on
    OS X were a big problem.

Q: startup time issues for packaged applications?
A: yes, but not a real high priority to track down; seems worse on first run
    in new install (probably compilation to byte codes).

Q: Did you eval Qt and PyQt when considering cross platform GUI toolkits?
A: No, due to funds -- want application to be used for commercial stuff, that would probably require Qt license.  (JB: Those are expensive, but great if you can afford them!  Also don't think latest Windows version was GPL released when they started this.)

Q: Did you find that if you designed first on OS X did it help with the
    layout issues?
A: It did help, but things like font sizes were still an issue. wx does
    not include an auto-wrapping static text widget which is an issue.

Q about Debian support that I didn't catch; sounds like has been low priority but will be addressed in the future.

Q: How do you testing on your GUI front end?
A: Do a build, email the staff :)
    Actually saw some sort of wx stub project for automated testing
    recently but haven't tried it yet
    Eggplant commercial tool gets plugged

Q: Heavy ties to wx 2.4 legacy code seen as barrier to OS X adoption,
   although X11 works [ick -- ed.].
A: wx on OS X is mostly on 2.5 version -- not stable yet.  ccPublisher
is on 2.5 tree.  You have to make a choice -- don't know how far off 2.6 is (they've said January -- year?) [I thought he meant it was due on Jan '05 and therefore late]

REFERENCES: {as documents / sites are referenced add them below} (?) -- Eggplant (Redstone Software)


CONTRIBUTORS: {add your name, e-mail address and URL below}
Nate Silva <>
Russell Finn <>
Jonathan Blocksom <>
Brad Allen <> (only minor typing help--mostly lurking)

E-MAIL BOUNCEBACK: {add your e-mail address separated by commas }

A headline (like a field in a database) will be CAPITALISED
    This differentiates from the text that follows
A variable that you can change will be surrounded by _underscores_
    Spaces in variables are also replaced with under_scores
    This allows people to select the whole variable with a simple double-click
A tool-tip is lower case and surrounded by {curly brackets / parentheses}
    These supply helpful contextual information.

Copyright shared between all the participants unless otherwise stated...