book on wxPython?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Grant Edwards

    book on wxPython?

    Can anybody recommend a good book on wxPython? Are there any
    books on wxPython?

    I've been trying to learn wxPython and/or wax for a few weeks,
    and I'm just not getting it. [I wrote and shipped one small
    wxPython app a couple years ago, and it was a cut/paste, trial
    and error sort of exercise.]

    wxWindows seems to be more low-level than the other GUI
    toolkits I've used (Tk, GTK, and Trestle[1]), and there are all
    sorts exposed details in wxWindows/wxPython that I find weird.

    For example, I'm still confused about how to tell what the
    "parent" of a widget should be. When you put a StaticBox in a
    Panel, the Panel is the parent of the StaticBox. When you put
    SomeOtherWidget in the StaticBox, why is the parent of
    SomeOtherWidget the Panel and not the StaticBox?

    And what about sizers? They seem to be a sort of parallel,
    phantom tree of widgets that's stuck on the side of the real
    tree of widgets, while other GUI toolkits treat layout widgets
    (grids, hboxes, vboxes, etc) as a "first-class" widgets that
    reside in the same tree as the widgets that actually draw
    stuff.

    Anyway, I'd really love to find a good book on wxPython. I'm
    still working through wxPython tutorials, and I've read through
    some of the wxWindows ones (which are of limited value for
    somebody steadfastly determined to remain clueless about C++).

    I'm also still reading stuff on wiki.wxpython.o rg, but Wikis
    always seem so fragmented...

    [1] I still think the hbox/vbox/glue abstraction used by
    Trestle was one of the easiest to use. Probably because
    I've been using TeX and LaTeX for 25 years.

    --
    Grant Edwards grante Yow! How do I get HOME?
    at
    visi.com
  • Ryan Paul

    #2
    Re: book on wxPython?

    On Sat, 15 May 2004 03:32:00 +0000, Grant Edwards wrote:
    [color=blue]
    > Can anybody recommend a good book on wxPython? Are there any
    > books on wxPython?[/color]

    I have a copy of the python2.1 bible. Its a bit outdated, but it has a
    really good section on wxpython. Its by no means a comprehensive
    exploration of wx, but gives a good presentation. The book is nice to have
    around for other things too, it has good examples, and it really helped
    extend my understanding of several facets of python.

    [color=blue]
    > wxWindows seems to be more low-level than the other GUI
    > toolkits I've used (Tk, GTK, and Trestle[1]), and there are all
    > sorts exposed details in wxWindows/wxPython that I find weird.[/color]

    wxWindows is far from low level. it is a cross-platform compatible wrapper
    that sits on top of other toolkits. (Gtk on linux, for instance) It seems
    'low-level' because the python bindings have very unpythonic syntax.
    People say that WAX fixes this. (I've never used it)
    [color=blue]
    > Anyway, I'd really love to find a good book on wxPython. I'm
    > still working through wxPython tutorials, and I've read through
    > some of the wxWindows ones (which are of limited value for
    > somebody steadfastly determined to remain clueless about C++).[/color]

    I applaud your efforts to stay C++ free, and I sincerely hope you have
    more luck in that endeavor than I did!

    You might find that perusing wxPython examples helps more than reading
    those insidious c++ tutorials. The WxPython demo includes a comprehensive
    collection of examples, showing how to use just about every single widget.
    You might want to take a look at it.

    --SegPhault

    Comment

    • Grant Edwards

      #3
      Re: book on wxPython?

      In article <pan.2004.05.15 .03.52.15.66794 0@sbcglobal.net >, Ryan Paul wrote:
      [color=blue]
      > I have a copy of the python2.1 bible. Its a bit outdated, but
      > it has a really good section on wxpython. [...][/color]

      Thanks, I'll check into it.
      [color=blue][color=green]
      >> wxWindows seems to be more low-level than the other GUI
      >> toolkits I've used (Tk, GTK, and Trestle[1]), and there are
      >> all sorts exposed details in wxWindows/wxPython that I find
      >> weird.[/color]
      >
      > wxWindows is far from low level.[/color]

      For an example of what I mean by low-level, there's a "hello
      world" example from an O'Reilly book I ran across earlier this
      evening: <http://www.onlamp.com/lpt/a/196>. The Tkinter example
      is 5 lines of code and includes a button that executes a
      command when it's pushed. The wxPython "hello world example"
      is twice as many lines of code and is just an empty frame: it
      doesn't even include the button (that would have made it three
      times as many lines of code). With Tk, a lot of the low-level
      details are handled automatically, but in wxWindows, you have
      to do them manually. Perhaps that gains you flexibility, but if
      you don't need that flexibility, all it gains you is pain:
      something that's one line of code in Tk seems to be typically
      three or four lines of code in wxPython.

      Another example: When you create a widget you have to tell it
      who its parent is. Then in a separate operation, you have to
      tell the parent about the child. Why is the link between
      child/parent set in two places? That's just a bug waiting to
      happen: splitting up a single piece of information and putting
      the two halves in two different places in the source code where
      they have to be maintained in concert has always proven to be a
      bad thing in my experience. Why can't the operation where you
      add a child to a parent also add the parent to the child? Does
      the child actually need to know who its parent is during the
      interval between the child's creation and the child being added
      to its parent? Perhaps it does. Is there an advantage to
      doing the parent/child linkage in two separate operations?
      Perhaps there is. But when there's no explanation of what the
      extra complexity/fragility buys you, it just looks sort of
      broken and "low-level".

      For a final example, in a previous thread I already went on and
      on about the integer widget and event IDs and separate
      "linking" functions used to connect handlers, events, and
      widgets. That seems much lower-level than just passing the
      callable when you create the widget or letting the widget
      object have attributes or get/set methods that can be used to
      set up the callable for an event. Again, there is some added
      flexibility to the wxWindows approach, but I don't need that
      sort of flexibility for the apps I write, so all I get is the
      fun of writing triple the lines of code.

      It's sort of like C vs. Python: C is a lower-level language, so
      you have more flexible control over many things. That
      flexibility is expensive: you have to write more lines of code,
      and that code is much harder to read, debug, and maintain.
      Since the programmer is responsible for more of the details,
      more of the details are wrong.
      [color=blue]
      > it is a cross-platform compatible wrapper that sits on top of
      > other toolkits. (Gtk on linux, for instance) It seems
      > 'low-level' because the python bindings have very unpythonic
      > syntax.[/color]

      No, not just the syntax, but some of the basic architectural
      design seems to be more low-level to me. Sizers, for example,
      appear to be an afterthought, and you have to sort of stick
      them onto your widgets manually. That functionality is part of
      the fundamental design of other GUI toolkits and just happens
      automatically.
      [color=blue]
      > People say that WAX fixes this. (I've never used it)[/color]

      I'm trying out wax, and it's definitely an improvement, but
      it's not ready for production yet. One of the widgets I want
      to use doesn't work right, and due to the baroqueness of
      wxWindows, nobody seems to know why. I'm going to take a whack
      at fixing some bugs, but I'll need to know a lot more about
      wxWindows and wxPython and sizers and whatnot than I do now.
      Hence the search for documentation. One page I found said that
      sizers were written in pure Python and therefore not part of
      wxWindows, and for documentation on how to use them, you should
      consult the wxWindows manuals. Huh?
      [color=blue][color=green]
      >> Anyway, I'd really love to find a good book on wxPython. I'm
      >> still working through wxPython tutorials, and I've read
      >> through some of the wxWindows ones (which are of limited value
      >> for somebody steadfastly determined to remain clueless about
      >> C++).[/color]
      >
      > I applaud your efforts to stay C++ free, and I sincerely hope
      > you have more luck in that endeavor than I did![/color]

      So far, so good.
      [color=blue]
      > You might find that perusing wxPython examples helps more than reading
      > those insidious c++ tutorials. The WxPython demo includes a comprehensive
      > collection of examples, showing how to use just about every single widget.
      > You might want to take a look at it.[/color]

      I've been looking through those, and am still confused about a
      lot of things (e.g. parent links and sizers).

      I printed out some wxpywiki pages to read in my spare time...

      --
      Grant Edwards grante Yow! I wonder if I ought
      at to tell them about my
      visi.com PREVIOUS LIFE as a COMPLETE
      STRANGER.

      Comment

      • F. GEIGER

        #4
        Re: book on wxPython?

        Mark Hammond's book "Python Programming on Win32" helped me a lot in
        entering wxWindows (oops, sorry, wxWidgets of course) programming. A 2nd
        source of "no, how?" I can recommend is the wxPython Wiki with a few
        essential recipies. And the wxWidget help coming with wxPython is a good
        resource a soon as you were able to get started.

        HTH
        Franz GEIGER

        "Grant Edwards" <grante@visi.co m> schrieb im Newsbeitrag
        news:slrncab3p3 .ou5.grante@gra nte.rivatek.com ...[color=blue]
        > Can anybody recommend a good book on wxPython? Are there any
        > books on wxPython?
        >
        > I've been trying to learn wxPython and/or wax for a few weeks,
        > and I'm just not getting it. [I wrote and shipped one small
        > wxPython app a couple years ago, and it was a cut/paste, trial
        > and error sort of exercise.]
        >
        > wxWindows seems to be more low-level than the other GUI
        > toolkits I've used (Tk, GTK, and Trestle[1]), and there are all
        > sorts exposed details in wxWindows/wxPython that I find weird.
        >
        > For example, I'm still confused about how to tell what the
        > "parent" of a widget should be. When you put a StaticBox in a
        > Panel, the Panel is the parent of the StaticBox. When you put
        > SomeOtherWidget in the StaticBox, why is the parent of
        > SomeOtherWidget the Panel and not the StaticBox?
        >
        > And what about sizers? They seem to be a sort of parallel,
        > phantom tree of widgets that's stuck on the side of the real
        > tree of widgets, while other GUI toolkits treat layout widgets
        > (grids, hboxes, vboxes, etc) as a "first-class" widgets that
        > reside in the same tree as the widgets that actually draw
        > stuff.
        >
        > Anyway, I'd really love to find a good book on wxPython. I'm
        > still working through wxPython tutorials, and I've read through
        > some of the wxWindows ones (which are of limited value for
        > somebody steadfastly determined to remain clueless about C++).
        >
        > I'm also still reading stuff on wiki.wxpython.o rg, but Wikis
        > always seem so fragmented...
        >
        > [1] I still think the hbox/vbox/glue abstraction used by
        > Trestle was one of the easiest to use. Probably because
        > I've been using TeX and LaTeX for 25 years.
        >
        > --
        > Grant Edwards grante Yow! How do I get[/color]
        HOME?[color=blue]
        > at
        > visi.com[/color]


        Comment

        • Thomas

          #5
          Re: book on wxPython?

          Hi,

          try making a small App with Boa Constructor and
          look at the code afterwards

          just my 2 (Euro) Cents :-)
          Thomas

          Comment

          • francois lepoutre

            #6
            Re: book on wxPython?

            > Can anybody recommend a good book on wxPython?[color=blue]
            > Are there any books on wxPython?[/color]

            You're not alone waiting for the wxpython book.

            As a lot of python users, i just learned python from
            a couple of web resources, referring to books later
            and mostly for reference or unusal tricks.

            Learning a UI, specifically when you're not an
            MFC (or unix eq.) guru, is another matter.

            I expect that this wx* book, whatever its quality
            and price, would make more to the project than
            additional web resources or bug fixes...

            At some stage, when dealing with complexity,
            you 've got to:
            -solution 1, expect a quantic leap in terms
            of "making the thing simpler", something like
            a python way for UIs;
            In view of the recent discusssion on the wxpython
            mailing lists, it looks like the chances of a massive
            "simplification " are getting dimmer over time..
            -solution 2 - read the carefully writtent book
            before diving.

            Dear O'Reilly, do you hear us?

            François



            Comment

            • Aahz

              #7
              Re: book on wxPython?

              In article <slrncab3p3.ou5 .grante@grante. rivatek.com>,
              Grant Edwards <grante@visi.co m> wrote:[color=blue]
              >
              >Can anybody recommend a good book on wxPython? Are there any
              >books on wxPython?[/color]


              --
              Aahz (aahz@pythoncra ft.com) <*> http://www.pythoncraft.com/

              Adopt A Process -- stop killing all your children!

              Comment

              • Roger Binns

                #8
                Re: book on wxPython?

                Grant Edwards wrote:[color=blue]
                > The wxPython "hello world example"
                > is twice as many lines of code and is just an empty frame: it
                > doesn't even include the button (that would have made it three
                > times as many lines of code).[/color]

                Ok, now add printing, drag and drop and comboboxes. You'll find
                you can't or you have to use external libraries with Tkinter.
                The price you pay for wxPython's flexibility and functionality
                is that you have to be a little more specific in telling it
                what you want to do.
                [color=blue]
                > Another example: When you create a widget you have to tell it
                > who its parent is.[/color]

                Note that this is true of all gui toolkits at some point.
                You have a containment hierarchy and have to specify it.
                Eg a button is inside a text widget is inside a frame.
                [color=blue]
                > Then in a separate operation, you have to
                > tell the parent about the child.[/color]

                That is news to this programmer who has been doing
                wxPython for 3 years!

                I don't know where you got that from, but it simply isn't
                true. Call GetParent() and GetChildren() and you will find
                that all the information is correctly managed automatically.
                [color=blue]
                > For a final example, in a previous thread I already went on and
                > on about the integer widget and event IDs and separate
                > "linking" functions used to connect handlers, events, and
                > widgets. That seems much lower-level than just passing the
                > callable when you create the widget or letting the widget
                > object have attributes or get/set methods that can be used to
                > set up the callable for an event.[/color]

                That just happens to mirror how the insides work. It isn't too
                much effort to make a higher level wrapper that does what you
                want, but in all the years that wxPython has been available
                few programmers have thought it would improve their productivity,
                quality or other code attributes. One example you have already
                seen of someone who thought it would is Wax.
                [color=blue]
                > Sizers, for example,
                > appear to be an afterthought, and you have to sort of stick
                > them onto your widgets manually. That functionality is part of
                > the fundamental design of other GUI toolkits and just happens
                > automatically.[/color]

                Generally the problem is that people don't understand that there
                are three seperate hierarchives when dealing with GUIs. There
                is the classes of the various controls, there is the instance
                hierarchy and there is the layout hierarchy.

                For some gui toolkits the last two are combined. If you have a
                clean sheet original implementation then you can make that work
                well as it imposes some constraints on the controls to keep the
                two hierarchies the same. wxWidgets doesn't have the luxury
                of a clean sheet design (it has to work with the existing
                widgets of the underlying platform).

                In general you should view wxWidgets/Python as a pragmatic
                approach to getting a fairly high common appearance and
                functionality across multiple platforms. Sometimes the
                warts of underneath show through, but if you used the
                actual underlying toolkit you would be exposed to them
                anyway.

                Some other people or companies decided to do a clean
                slate thing and implement everything themselves, a
                good example being Trolltech and Qt. That is really
                hard to maintain. Tk also did this. You can see
                more of a consistency and less quirks in their
                resulting APIs.

                The good news is that Python does make it easy to
                put wrappers around wrappers. Most wxPython programmers
                haven't felt it necessary, but if you do the
                groundwork is already laid.

                Roger


                Comment

                • Grant Edwards

                  #9
                  Re: book on wxPython?

                  In article <js4hn1-mo7.ln1@home.ro gerbinns.com>, Roger Binns wrote:
                  [color=blue]
                  > Ok, now add printing, drag and drop and comboboxes.[/color]

                  No thanks. I don't do printing or drag and drop. Or
                  comboboxes now that I think about it. My needs are fairly
                  simple, and Tkinter would suffice nicely, except that the
                  non-native look and feel seems to confuse Windows users.
                  [color=blue]
                  > You'll find you can't or you have to use external libraries
                  > with Tkinter.[/color]

                  Moot. [For me.]
                  [color=blue]
                  > The price you pay for wxPython's flexibility and functionality
                  > is that you have to be a little more specific in telling it
                  > what you want to do.[/color]

                  I know. I'm paying the price, I feel like I don't get any
                  benefits.
                  [color=blue][color=green]
                  >> Another example: When you create a widget you have to tell it
                  >> who its parent is.[/color]
                  >
                  > Note that this is true of all gui toolkits at some point. You
                  > have a containment hierarchy and have to specify it. Eg a
                  > button is inside a text widget is inside a frame.
                  >[color=green]
                  >> Then in a separate operation, you have to tell the parent
                  >> about the child.[/color]
                  >
                  > That is news to this programmer who has been doing
                  > wxPython for 3 years![/color]

                  What are all the calls that look like parent.AddWindo w(child,...)?
                  [color=blue]
                  > I don't know where you got that from, but it simply isn't
                  > true. Call GetParent() and GetChildren() and you will find
                  > that all the information is correctly managed automatically.
                  >[color=green]
                  >> For a final example, in a previous thread I already went on
                  >> and on about the integer widget and event IDs and separate
                  >> "linking" functions used to connect handlers, events, and
                  >> widgets. That seems much lower-level than just passing the
                  >> callable when you create the widget or letting the widget
                  >> object have attributes or get/set methods that can be used to
                  >> set up the callable for an event.[/color]
                  >
                  > That just happens to mirror how the insides work.[/color]

                  I don't think that's a good excuse for what appears (to me) to
                  be a fragile API. The purpose of an API is to hide how the
                  insides work.
                  [color=blue]
                  > It isn't too much effort to make a higher level wrapper that
                  > does what you want, but in all the years that wxPython has
                  > been available few programmers have thought it would improve
                  > their productivity, quality or other code attributes. One
                  > example you have already seen of someone who thought it would
                  > is Wax.[/color]

                  Like I said, I think Wax is a vast improvement. I'd like to
                  help out with Wax, but I'm having a tough time finding basic
                  documentation on wxPython so that I can figure out why some of
                  the Wax classes don't behave as intended.
                  [color=blue][color=green]
                  >> Sizers, for example, appear to be an afterthought, and you
                  >> have to sort of stick them onto your widgets manually. That
                  >> functionality is part of the fundamental design of other GUI
                  >> toolkits and just happens automatically.[/color]
                  >
                  > Generally the problem is that people don't understand that
                  > there are three seperate hierarchives when dealing with GUIs.
                  > There is the classes of the various controls, there is the
                  > instance hierarchy and there is the layout hierarchy.[/color]

                  Thank you!

                  Where do I find the documentation that explains things like
                  that? Teasing it out of people on Usenet is obviously a waste
                  of everybody's time.

                  All I can find is documentaiton on the class hierarchy. I've
                  looked at demo source code, but am having a tough time figuring
                  out why things are written certain ways.
                  [color=blue]
                  > For some gui toolkits the last two are combined.[/color]

                  For all the ones I've used in the past, the last two are
                  combined. Your posting is the first place I've seen it
                  explained explicitly that the control and layout hierarchy are
                  separate in wxPython. That probably explains most of my
                  confusion over the parent/child linkage. Not being aware that
                  there are two separate hierachies involved where I'm used to
                  one, it looks like there's a lot of odd redundancy involved in
                  setting up things.
                  [color=blue]
                  > If you have a clean sheet original implementation then you can
                  > make that work well as it imposes some constraints on the
                  > controls to keep the two hierarchies the same. wxWidgets
                  > doesn't have the luxury of a clean sheet design (it has to
                  > work with the existing widgets of the underlying platform).[/color]

                  That's true.
                  [color=blue]
                  > In general you should view wxWidgets/Python as a pragmatic
                  > approach to getting a fairly high common appearance and
                  > functionality across multiple platforms. Sometimes the warts
                  > of underneath show through, but if you used the actual
                  > underlying toolkit you would be exposed to them anyway.[/color]

                  I guess those warts must be from some of the "underneath s" I've
                  never worked with.
                  [color=blue]
                  > Some other people or companies decided to do a clean slate
                  > thing and implement everything themselves, a good example
                  > being Trolltech and Qt. That is really hard to maintain. Tk
                  > also did this. You can see more of a consistency and less
                  > quirks in their resulting APIs.[/color]

                  I agree (obviously).
                  [color=blue]
                  > The good news is that Python does make it easy to put wrappers
                  > around wrappers. Most wxPython programmers haven't felt it
                  > necessary, but if you do the groundwork is already laid.[/color]

                  And I'm trying to find information to help me work on that.

                  --
                  Grant Edwards grante Yow! All right, you
                  at degenerates! I want this
                  visi.com place evacuated in 20
                  seconds!

                  Comment

                  • Andreas Kostyrka

                    #10
                    Re: book on wxPython?

                    Am Sa, den 15.05.2004 schrieb Grant Edwards um 19:23:[color=blue]
                    > In article <js4hn1-mo7.ln1@home.ro gerbinns.com>, Roger Binns wrote:
                    >[color=green]
                    > > Ok, now add printing, drag and drop and comboboxes.[/color]
                    >
                    > No thanks. I don't do printing or drag and drop. Or
                    > comboboxes now that I think about it. My needs are fairly
                    > simple, and Tkinter would suffice nicely, except that the
                    > non-native look and feel seems to confuse Windows users.[/color]
                    That's the price you pay for having a nice API that is implemented
                    without "native" widgets. wxWindows (and wxPython upon it) is "more
                    complicated" because it has to deal with a number of native
                    implementations . By the way, wxWindows does a API model that is
                    relativly close to Windows developement ;)[color=blue]
                    >[color=green]
                    > > You'll find you can't or you have to use external libraries
                    > > with Tkinter.[/color]
                    >
                    > Moot. [For me.][/color]
                    Not exactly. While you do not need printing and drag-n-drop, you checked
                    the "native look" item above. So Tk is not a sensible solution for you.

                    [color=blue][color=green]
                    > > It isn't too much effort to make a higher level wrapper that
                    > > does what you want, but in all the years that wxPython has
                    > > been available few programmers have thought it would improve
                    > > their productivity, quality or other code attributes. One
                    > > example you have already seen of someone who thought it would
                    > > is Wax.[/color]
                    >
                    > Like I said, I think Wax is a vast improvement. I'd like to
                    > help out with Wax, but I'm having a tough time finding basic
                    > documentation on wxPython so that I can figure out why some of
                    > the Wax classes don't behave as intended.[/color]
                    Well, read the wxWidgets docs. ;)

                    Andreas
                    --
                    Andreas Kostyrka
                    Josef-Mayer-Strasse 5
                    83043 Bad Aibling

                    Comment

                    • Roger Binns

                      #11
                      Re: book on wxPython?

                      Grant Edwards wrote:[color=blue]
                      > In article <js4hn1-mo7.ln1@home.ro gerbinns.com>, Roger Binns wrote:
                      >[color=green]
                      > > Ok, now add printing, drag and drop and comboboxes.[/color]
                      >
                      > No thanks. I don't do printing or drag and drop. Or
                      > comboboxes now that I think about it. My needs are fairly
                      > simple, and Tkinter would suffice nicely, except that the
                      > non-native look and feel seems to confuse Windows users.[/color]

                      Then use whatever suits you best! To a certain extent this
                      is like the differences between accessing a file and just
                      reading lines, then moving up to structuring the information
                      in the file as CSV and finally a full fledged database.

                      Code that works with one step gets increasingly difficult
                      to work with the next step, unless you adopt a new library.
                      The APIs will assume increasing knowledge, and may even
                      require more code to use, but the capabilities available
                      to you in other bits of code increase.
                      [color=blue]
                      > I know. I'm paying the price, I feel like I don't get any
                      > benefits.[/color]

                      It depends on what the future for your application is. My main
                      application (bitpim) runs on Windows, Linux and Mac. It makes
                      extensive use of threading, has custom controls, data manipulation,
                      printing, HTML integration etc etc. Obviously getting the initial
                      bit going took a little longer than Tkinter, but after the first
                      week or so the other parts were a lot easier and I haven't had
                      to say no to functionality (such as printing, drag & drop, HTML
                      etc).
                      [color=blue][color=green]
                      > > That is news to this programmer who has been doing
                      > > wxPython for 3 years![/color]
                      >
                      > What are all the calls that look like parent.AddWindo w(child,...)?[/color]

                      Ah, that is to do with the layout hierarchy, which has nothing
                      to do with the containment hierarchy. Most people just
                      use the sizer.Add method which is polymorphic.

                      BTW the layout hierarchy is optional - you can use absolute sizing
                      and positioning of your controls if you want. (And that is normal
                      for Windows apps - note how few dialog boxes you can resize! That
                      is a consequence of layout management being a pain using the
                      real Windows APIs.)
                      [color=blue]
                      > I don't think that's a good excuse for what appears (to me) to
                      > be a fragile API. The purpose of an API is to hide how the
                      > insides work.[/color]

                      Yes, but at some point controls, events and functions acting
                      on events have to be bound together, sometimes taking into
                      account the class, containment or layout hierarchies. I'll
                      admit that wxPython's isn't the most concise or most beautiful.
                      But they do work. They have never been a hindrance on my
                      productivity, and a suspect many other people's. But if you
                      have a better way of expressing that, after you understand
                      it all at a lower level then please propose it. (I can't
                      really think of any).
                      [color=blue][color=green]
                      > > Generally the problem is that people don't understand that
                      > > there are three seperate hierarchives when dealing with GUIs.
                      > > There is the classes of the various controls, there is the
                      > > instance hierarchy and there is the layout hierarchy.[/color]
                      >
                      > Thank you!
                      >
                      > Where do I find the documentation that explains things like
                      > that? Teasing it out of people on Usenet is obviously a waste
                      > of everybody's time.[/color]

                      They are actually quite hard concepts to explain, and various
                      tutorials, the online documentation and wikis do try to
                      explain them. I don't think any of them do a particularly
                      good job.

                      However do feel free to write your own explanation and
                      contribute it to the Wiki.
                      [color=blue]
                      > All I can find is documentaiton on the class hierarchy. I've
                      > looked at demo source code, but am having a tough time figuring
                      > out why things are written certain ways.[/color]

                      You should post your questions on the wxpython-users mailing list.
                      Almost all questions are answered very quickly.
                      [color=blue]
                      > Not being aware that
                      > there are two separate hierachies involved where I'm used to
                      > one, it looks like there's a lot of odd redundancy involved in
                      > setting up things.[/color]

                      There are arguments for and against combining the containment
                      hierarchy and the layout hierarchy. For wxWidgets it is that
                      the layout management is kept seperate from controls that
                      draw themselves. This makes controls less complicated since
                      they only have to worry about how to draw, and do not have
                      to worry about arbitrarily complex child widgets to layout.
                      Similarly layout management objects (aka sizers) only have to
                      worry about layout, and not about drawing.

                      I won't argue as to what is best, but do believe the wxWidgets
                      approach is reasonable.
                      [color=blue][color=green]
                      > > Sometimes the warts
                      > > of underneath show through, but if you used the actual
                      > > underlying toolkit you would be exposed to them anyway.[/color]
                      >
                      > I guess those warts must be from some of the "underneath s" I've
                      > never worked with.[/color]

                      You should try the various native gui toolkits someday - stuff
                      like win32, MFC, Xlib, Motif. wxWidgets/wxPython is an absolute
                      joy compared to them.

                      The real masochist can try MFC on PocketPC. The MFC source,
                      the PocketPC documentation and what the code actually does
                      frequently differ.
                      [color=blue][color=green]
                      > > The good news is that Python does make it easy to put wrappers
                      > > around wrappers. Most wxPython programmers haven't felt it
                      > > necessary, but if you do the groundwork is already laid.[/color]
                      >
                      > And I'm trying to find information to help me work on that.[/color]

                      I would recommend you give wxPython 6 months even if it is hard.
                      It is always better to more thoroughly understand something
                      before wrapping it, or taking a different approach.

                      From my own experience, each time you try something new such
                      as one of the more complicated controls, printing, drawing,
                      clipboard, "virtual" data or writing your own control, then
                      there is a little bit of a learning curve. In many cases
                      the demo (which is often overlooked) helps tremendously,
                      the documentation helps a little, and just sitting there
                      and writing code brings about the final closure. But that
                      always happens to some degree with any toolkit.

                      The quality of the toolkit, the variety of widgets, and core
                      functionality keep getting better. The cold hard reality is
                      that using wxPython today means you can deliver an application
                      that will run on a large variety of operating systems, screen
                      sizes, characters sets and unicode, and work the way the user
                      of the operating system expects (drag and drop, printing,
                      clipboards, common dialogs etc). It costs you nothing,
                      there is no vendor lock-in, and there is a lively community
                      behind it. Suits me!

                      Roger


                      Comment

                      • Grant Edwards

                        #12
                        Re: book on wxPython?

                        In article <mailman.5.1084 691991.13608.py thon-list@python.org >, Andreas Kostyrka wrote:
                        [color=blue][color=green][color=darkred]
                        >>> Ok, now add printing, drag and drop and comboboxes.[/color]
                        >>
                        >> No thanks. I don't do printing or drag and drop. Or
                        >> comboboxes now that I think about it. My needs are fairly
                        >> simple, and Tkinter would suffice nicely, except that the
                        >> non-native look and feel seems to confuse Windows users.[/color][/color]
                        [color=blue]
                        > That's the price you pay for having a nice API[/color]

                        For some values of nice. :)
                        [color=blue]
                        > that is implemented without "native" widgets. wxWindows (and
                        > wxPython upon it) is "more complicated" because it has to deal
                        > with a number of native implementations . By the way, wxWindows
                        > does a API model that is relativly close to Windows
                        > developement ;)[/color]

                        Well I've never done Windows development (by "Windows" I assume
                        you mean MS), so that may explain some of my bewilderment.

                        --
                        Grant Edwards grante Yow! YOW!!! I am having
                        at fun!!!
                        visi.com

                        Comment

                        • Grant Edwards

                          #13
                          Re: book on wxPython?

                          In article <cfcjn1-6ue.ln1@home.ro gerbinns.com>, Roger Binns wrote:
                          [color=blue]
                          > Then use whatever suits you best![/color]

                          Everything seems unsuitable in different ways. Life's like
                          that. wxWindows is looking better.
                          [color=blue]
                          > It depends on what the future for your application is. My
                          > main application (bitpim) runs on Windows, Linux and Mac.[/color]

                          Cool app by the way. I used it to load my phone list into my
                          brand-new LG VX4400 about a year ago. [Best damned cell phone
                          I've ever used, and I've been using cellular phones for 20+
                          years.]
                          [color=blue][color=green][color=darkred]
                          >>> That is news to this programmer who has been doing wxPython
                          >>> for 3 years![/color]
                          >>
                          >> What are all the calls that look like parent.AddWindo w(child,...)?[/color]
                          >
                          > Ah, that is to do with the layout hierarchy, which has nothing
                          > to do with the containment hierarchy.[/color]

                          I just figured that out. It's something that's it's taken me
                          over two years to realize (well, I wasn't working with
                          wxWindows for most of that two years). Basic stuff like that
                          is what somebody needs to write down somewhere.
                          [color=blue]
                          > BTW the layout hierarchy is optional - you can use absolute
                          > sizing and positioning of your controls if you want. (And
                          > that is normal for Windows apps - note how few dialog boxes
                          > you can resize![/color]

                          Yup, that's a source of never-ending frustration when I am
                          occasionally forced to use MS-Windows.
                          [color=blue]
                          > Yes, but at some point controls, events and functions acting
                          > on events have to be bound together, sometimes taking into
                          > account the class, containment or layout hierarchies. I'll
                          > admit that wxPython's isn't the most concise or most beautiful.
                          > But they do work. They have never been a hindrance on my
                          > productivity, and a suspect many other people's. But if you
                          > have a better way of expressing that, after you understand
                          > it all at a lower level then please propose it. (I can't
                          > really think of any).[/color]

                          Not realizing that the containment and layout trees are
                          _separate_ is half of what made wxPython apps appear to be a
                          mess.

                          None of the tutorials I worked through ever mentioned that the
                          containment tree and the layout tree are separate. Perhaps
                          that fact was obvious to everybody else, but I missed it
                          completely. I thought I was constructing a single tree, and it
                          was taking twice as much code as I thought it should.

                          [I still think the whole integer ID thing should be hidden from
                          the programmer, but perhaps a light will come on one of these
                          days and that will then make sense to me as well.]
                          [color=blue][color=green][color=darkred]
                          >>> Generally the problem is that people don't understand that
                          >>> there are three seperate hierarchives when dealing with GUIs.
                          >>> There is the classes of the various controls, there is the
                          >>> instance hierarchy and there is the layout hierarchy.[/color]
                          >>
                          >> Thank you!
                          >>
                          >> Where do I find the documentation that explains things like
                          >> that? Teasing it out of people on Usenet is obviously a waste
                          >> of everybody's time.[/color]
                          >
                          > They are actually quite hard concepts to explain,[/color]

                          Is this more or less right?

                          In Tk and Trestle and ??? there is a single tree of widgets.
                          Some widgets impliment behaviors, handle user input events
                          (mouse clicks, keystrokes, etc.) and draw stuff on the
                          screen. Some widgets just arrange and size their children.
                          Some do both.

                          By contrast, in wxWidgets there are two separate trees.

                          One tree contains widgets that impliment behaviors by
                          handling user input events and drawing stuff on the screen.
                          That tree is constructed by passing the 'parent' pointer to
                          widget classes as you create instances. [I'm still a bit
                          foggy on the function of the parent-child relationship in
                          wxWidgets.]

                          The other tree contains sizers that control the layout (size
                          and position) of things. That tree is constructed by calling
                          a sizer's .Add() method to connect child sizers to a node.

                          In TeX-speak, sizers are like hboxes and vboxes where the and
                          widgets are like glyphs. The sizer tree defines what's
                          contained in each box. In wxWindows, the glyphs are also
                          connected in a tree structure.

                          footnote: It's possible to write an application without
                          using a sizer tree by manually setting the
                          position/size constraint attributes of the nodes
                          in the widget tree. Using these constraints, you
                          can either hard-wire sizes and positions in pixel
                          units, or try to impliment resizing the same way
                          sizers do. The former is evil, Evil, EVIL, and
                          will make people assume you're a MS Windows
                          weenie. The latter won't work right and make you
                          crazy.

                          The two trees are connected to each other in two ways:

                          1) by calling widgetInstance. SetSizer(sizerI nstance). For
                          most simple cases, this is done just once to connect the
                          top (root) nodes of the two trees together.

                          2) by calling sizerInstance.A dd(widgetInstan ce). This is
                          generally done for the sizer tree leaf nodes, but a node
                          in the sizer tree may have both widgets and other sizers
                          as children.

                          ...
                          [color=blue]
                          > and various tutorials, the online documentation and wikis do
                          > try to explain them. I don't think any of them do a
                          > particularly good job.
                          >
                          > However do feel free to write your own explanation and
                          > contribute it to the Wiki.[/color]

                          Once I'm confident I understand things, I think I will try to
                          write a Tk to WxWidgets perception adjustment guide.
                          [color=blue]
                          > I won't argue as to what is best, but do believe the wxWidgets
                          > approach is reasonable.[/color]

                          I think so as well. I just couldn't figure out what the
                          wxWidgets approach _was_.
                          [color=blue][color=green]
                          >> I guess those warts must be from some of the "underneath s" I've
                          >> never worked with.[/color]
                          >
                          > You should try the various native gui toolkits someday - stuff
                          > like win32, MFC, Xlib, Motif. wxWidgets/wxPython is an absolute
                          > joy compared to them.[/color]

                          I've done both plain Xlib apps and Xt apps with custom widgets.
                          Not fun, though I was pretty darned proud of my backgammon
                          board widget for Xt. The move animation was pretty cool. Too
                          bad it was controlled by the guts of the old brain-dead BSD
                          backgammon program -- it played a really lousy game.

                          Neither C nor Xlib/Xt is really suitable for modern end-user
                          application development. I've heard all sorts of nasty things
                          about Motif, so I never tried it.
                          [color=blue]
                          > I would recommend you give wxPython 6 months even if it is
                          > hard. It is always better to more thoroughly understand
                          > something before wrapping it, or taking a different approach.[/color]

                          I'm definitely going to stick with it. I blundered my way
                          though writing and shipping one small wxWindows app a while
                          back. Now that I've figured out the two-tree thing, it should
                          be easier.

                          --
                          Grant Edwards grante Yow! How many retired
                          at bricklayers from FLORIDA
                          visi.com are out purchasing PENCIL
                          SHARPENERS right NOW??

                          Comment

                          • Roger Binns

                            #14
                            Re: book on wxPython?

                            Grant Edwards wrote:[color=blue]
                            > Not realizing that the containment and layout trees are
                            > _separate_ is half of what made wxPython apps appear to be a
                            > mess.[/color]

                            Many programmers aren't even used to the idea of layout
                            hierarchies. It is very ingrained of you have ever done
                            Tk or Motif, but not something you will know about as a
                            Windows programmer.
                            [color=blue]
                            > Perhaps that fact was obvious to everybody else, but I missed it
                            > completely.[/color]

                            I don't think it is obvious at all. There is an overview about
                            them in the doc, as well as some pages in the wiki.
                            [color=blue]
                            > [I still think the whole integer ID thing should be hidden from
                            > the programmer, but perhaps a light will come on one of these
                            > days and that will then make sense to me as well.][/color]

                            I use them because I have menu items, toolbar buttons and buttons
                            in HTML that all need to reference the same thing. An integer
                            ID does the trick nicely.
                            [color=blue]
                            > [I'm still a bit
                            > foggy on the function of the parent-child relationship in
                            > wxWidgets.][/color]

                            A child widget is within its parent - it will be clipped to
                            its parent, and is drawn on top of its parent. Some events
                            (eg command events) are delivered to a widget and if it
                            doesn't handle them then sent up the containment hierarchy.
                            [color=blue]
                            > I've heard all sorts of nasty things
                            > about Motif, so I never tried it.[/color]

                            I worked for the company that at one point had 70% of the
                            worldwide Motif market. At that time it had i18n features,
                            a resource system noone used (not the same as Xt resources,
                            but more like XRC in wxWidgets), and portability to the
                            many flavours of UNIX. (I once used Sony UNIX - yes it
                            really existed).

                            Then CDE came along and the rest is history.
                            [color=blue]
                            > I'm definitely going to stick with it. I blundered my way
                            > though writing and shipping one small wxWindows app a while
                            > back. Now that I've figured out the two-tree thing, it should
                            > be easier.[/color]

                            The best advice I can give you is to seriously examine the
                            XRC stuff. The XRC editor even comes with wxPython. That
                            will let you abstract out your user interface code (especially
                            the issues to do with layouts and parent relationships).
                            I just wish I had done it.

                            Roger


                            Comment

                            • Roger Binns

                              #15
                              Re: book on wxPython?

                              Andreas Kostyrka wrote:[color=blue]
                              > By the way, wxWindows does a API model that is
                              > relativly close to Windows developement ;)[/color]

                              The real Win32 API is based on the Win16 API which was a reasonable
                              design in 1983, but had a lot of premature size and performance
                              optimization. That premature optimization is extremely cruddy
                              now. MFC was a C++ wrapper that tried to do things more sensibly
                              (aka object oriented) but was constrained by the C++ language
                              of the time and the underlying Win32 API.

                              That said, MFC isn't *bad* a toolkit to base something like the
                              design of wxWidgets on. And wxWidgets has gone through two
                              major versions now and has significantly refined things.

                              Roger


                              Comment

                              Working...