Considering switching to wxPython

I am considering switching to wxPython (from PyQt). I have taken a quick
look at the documentation sufficient to create a favorable impression.
However, before I make the switch, I would like to confirm that things that
I do in PyQt are possible in wxPython.

1. Generate a drop-down list dynamically.
2. Stack 2 frames and select the one to be visible.
3. Create a list of text items with multiple columns. Choose the column to
use for sorting the items.
4. Programmatically change the background color of a row in the list of text
items (to highlight a selection, for example).

Also, I have read that wxPython offers a large variety of widgets. Where
can I find documentation on the available widgets? Is there a progress
bar? Can I provide a graphic for it to use as its background?

Finally, PyQt has a mechanism for handling signals that I like very much. I
can specify how to handle events related to the GUI and specify my own
signals. It appears that wxPython has a similar capability. Is this true?
Does it have any limitations compared to Qt?

···

--
Jeffrey Barish

I am considering switching to wxPython (from PyQt). I have taken a quick
look at the documentation sufficient to create a favorable impression.
However, before I make the switch, I would like to confirm that things that
I do in PyQt are possible in wxPython.

  wxPython is great, but suffers from a very non-Pythonic API. You
would probably be much better off using the ui module of Dabo, which
wraps wxPython and provides a much cleaner way of working with UI
object. No IDs, no ugly constants, property access to controls instead
of the getter/setter design of wxPython, consistent property naming
across controls, etc.

  While Dabo is a full three-tier application framework, I've used just
the dabo.ui module to build apps much quicker than I ever did with
wxPython.

1. Generate a drop-down list dynamically.

  In Dabo: given a list/tuple with your items, all you do is:
  
  dropdown.Choices = yourlist
  
  In raw wxPython, you have to clear the list and then repopulate it every time.

2. Stack 2 frames and select the one to be visible.

  Dabo has a class called dPageFrameNoTabs, which behaves like the
wx.Notebook control, but without any visible means of switching
between the pages; switching is done programmatically. You could set
up a single frame to contain this control, and put the contents of
your separate frames on each page.
  

3. Create a list of text items with multiple columns. Choose the column to
use for sorting the items.

  Sounds like a grid to me. Dabo grids feature clicking on the column
header to sort the grid by that column.

4. Programmatically change the background color of a row in the list of text
items (to highlight a selection, for example).

  Not sure on this, but I think it should be possible. If it isn't
currently, I'd post a message to the dabo-users or dabo-dev lists, and
chances are it'll get implemented in a day or two. The developers are
a very responsive bunch.

Also, I have read that wxPython offers a large variety of widgets. Where
can I find documentation on the available widgets? Is there a progress
bar? Can I provide a graphic for it to use as its background?

  Download the demo after you install wxPython - it has examples of
just about every available widget. Most of them are wrapped in Dabo,
but there are still some which are not. But like I said before: the
Dabo guys are very responsive, and seem eager to add whatever people
need.

Finally, PyQt has a mechanism for handling signals that I like very much. I
can specify how to handle events related to the GUI and specify my own
signals. It appears that wxPython has a similar capability. Is this true?
Does it have any limitations compared to Qt?

  I haven't used Qt, so I can't compare the two, but wxPython has a
full event model, and Dabo has wrapped that to make it both simpler
and more powerful. If you have specific questions about events and
event handling, post 'em here and someone will be able to answer them.

···

On 12/23/05, Jeffrey Barish <jeff_barish@earthlink.net> wrote:

--

# p.d.

Jeffrey Barish schrieb:

Also, I have read that wxPython offers a large variety of widgets. Where
can I find documentation on the available widgets? Is there a progress
bar? Can I provide a graphic for it to use as its background?

try to install the demo that accompanies wxpython. You get a good overview of the available widgets (and more) .

regards
  Uwe

I am considering switching to wxPython (from PyQt). I have taken a quick
look at the documentation sufficient to create a favorable impression.
However, before I make the switch, I would like to confirm that things that
I do in PyQt are possible in wxPython.

1. Generate a drop-down list dynamically.

ch = wx.Choice(..)
ch.Append()
ch.Insert()
ch.Delete()

2. Stack 2 frames and select the one to be visible.

Not having used PyQt, I would imagine that a PyQt 'Frame' is similar to
a wxWidgets (wxPython) 'Window'. Yes, various ways. wx.Notebook,
wx.Choicebook, wx.Listbook, etc.

3. Create a list of text items with multiple columns. Choose the column to
use for sorting the items.

Depending on your use, wx.GridCtrl or wx.ListCtrl

4. Programmatically change the background color of a row in the list of text
items (to highlight a selection, for example).

If you are doing row-oriented stuff, wx.ListCtrl

Also, I have read that wxPython offers a large variety of widgets. Where
can I find documentation on the available widgets? Is there a progress
bar? Can I provide a graphic for it to use as its background?

As Uwe stated, the wxPython demo shows quite a bit of the nifty stuff.
I don't believe that you can provide a background graphic to the
progress bar widget. There are some custom progress-bar-like widgets
out there, but I don't have my links handy.

Finally, PyQt has a mechanism for handling signals that I like very much. I
can specify how to handle events related to the GUI and specify my own
signals. It appears that wxPython has a similar capability. Is this true?

Yes, though wxPython (and wxWidgets) just call them "events".

Does it have any limitations compared to Qt?

I am not aware of any limitations of wxPython's event binding machinery.
Every widget that I have wanted to get events from has provided me with
the events that I've requested. The event names for a particular
control are provided in the documentation for that control or one of the
controls it subclasses.

- Josiah

···

Jeffrey Barish <jeff_barish@earthlink.net> wrote:

First, sorry for the private reply but there seems to be a problem with the list server handling gmail’s encoding properly, so this is the only way to make sure you get it without annoying a bunch of people.

  1. Generate a drop-down list dynamically.

I do this all the time, in a number of ways.

  1. Stack 2 frames and select the one to be visible.

To mirror the one fellow’s concern, if “frame” means something different in QT, that could cause confusion. A ‘frame’ in wx is the outermost level of a window with widgets, includes the title bar et all. You can have multiple frames open, and I BELIEVE that you can hide/show them at will, though I’ve never used that feature.

  1. Create a list of text items with multiple columns. Choose the column to

use for sorting the items.

In a number of ways. There are some basic choices, plus some third party and custom classes included with wx that should help.

  1. Programmatically change the background color of a row in the list of text items (to highlight a selection, for example).

Yes, in fact it’s quite easy to change the font, colors, and even graphics associated with a row in a wx.ListCtrl.

Also, I have read that wxPython offers a large variety of widgets. Where can I find documentation on the available widgets?

Download the archive and install. There is a DK document that is written for wx.Widgets (the C++ core libraries) but they are fairly easy to transliterate to Python. Plus, where there are differences, they are usually pointed out in the docs. There is a section called “Alphabetical Listing of Classes” and it includes everything that wx.Widgets does (it does not include everything that wx.Python does, but that is being worked on).

Along with the docs, the demo provides examples of most supported classes, shows source interactively, and even allows you to modify it in situ to see whta the changes will do.

Is there a progress bar? Can I provide a graphic for it to use as its background?

There is a progress bar, and a nice one it is, but it does not support customizable graphics. It is pretty simple to make a replacement using DataContexts (wx.DC) and I’ve done it in the past (was rather crude looking but the customer liked it).

Finally, PyQt has a mechanism for handling signals that I like very much. I can specify how to handle events related to the GUI and specify my own signals. It appears that wxPython has a similar capability. Is this true? Does it have any limitations compared to Qt?

There are two approaches to signal handling. The mainstream one is that which binds EVENTS from certain CLASSES to certain HANDLERS. You can bind an event to multiple handlers, bind class events to themselves, and so on. The second is using a third-party library included with wx, that uses the pub-sub model.

Generating your own events is easy to do, sample code is included. Again, do it all the time, no sweat.

Hope this helps.

···

On 12/23/05, Jeffrey Barish jeff_barish@earthlink.net wrote:


“I never gave anybody hell. I just told the truth and the Republicans thought it was hell.”

              - Harry S. Truman.

Best,

Jeff

Crap, that went out to the list. Applogies for any screwed up digests.

···

On 12/26/05, Jeff Grimmett <grimmtooth@gmail.com > wrote:

First, sorry for the private reply but there seems to be a problem with the list server handling gmail’s encoding properly, so this is

… etc …


“I never gave anybody hell. I just told the truth and the Republicans thought it was hell.”
- Harry S. Truman.

Best,

Jeff

Saturday, December 24, 2005, 12:27:08 AM, Jeffrey Barish wrote:

I am considering switching to wxPython (from PyQt). I have taken a
quick look at the documentation sufficient to create a favorable
impression. However, before I make the switch, I would like to
confirm that things that I do in PyQt are possible in wxPython.

I never user PyQt, but there's some info at
http://wiki.wxpython.org/index.cgi/ComparingWxPythonAndPyQt

1. Generate a drop-down list dynamically.

Yes. If you want its choices also to be dynamically generated it's
easy to derive a class from a wx.ControlWithItems-derived class to do
that.

2. Stack 2 frames and select the one to be visible.

It depends on what 'frames' mean. You could use wx.Notebook,
wx.Listbook, wx.Choicebook or create wx.Frames with the same size and
position and use their Show/Hide methods.

3. Create a list of text items with multiple columns. Choose the
column to use for sorting the items.

Yes. Text items, images, some controls...

4. Programmatically change the background color of a row in the list
of text items (to highlight a selection, for example).

Yes.

Also, I have read that wxPython offers a large variety of widgets.
Where can I find documentation on the available widgets?

wxPython API Documentation — wxPython Phoenix 4.2.2 documentation and on the wxPython demo.

Is there a progress bar?

Yes. We call it wx.Gauge, though.

Can I provide a graphic for it to use as its background?

No. But it's not that hard to create a custom gauge control using the
various wx.DC methods available.

Finally, PyQt has a mechanism for handling signals that I like very
much. I can specify how to handle events related to the GUI and
specify my own signals. It appears that wxPython has a similar
capability. Is this true?

Yes.

-- tacao

No bits were harmed during the making of this e-mail.

Well, since you were kind enough to call us a 'responsive bunch', I guess I felt obligated to not make you a liar! :wink:

     I've just added a SelectionMode property to the dGrid class that can be one of "row", "column", or "cell". This will highlight the row or column of the current cell if it is set to "row" or "column". You can control the color of the highlight with the SelectionBackColor and SelectionForeColor properties.

     Not too bad of a response on a holiday, eh?

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com

···

On Dec 25, 2005, at 11:23 AM, Peter Decker wrote:

4. Programmatically change the background color of a row in the list of text
items (to highlight a selection, for example).

    Not sure on this, but I think it should be possible. If it isn't
currently, I'd post a message to the dabo-users or dabo-dev lists, and
chances are it'll get implemented in a day or two. The developers are
a very responsive bunch.

Wow, that's great! And I see from the dev list that you've also added
a ledger effect, where alternate rows have different backgrounds.
That's a real nice effect to have.

Thanks again for all your amazing work. I predict that some day the
dabo.ui will become the standard for wxPython!

···

On 12/26/05, Ed Leafe <ed@leafe.com> wrote:

     I've just added a SelectionMode property to the dGrid class that
can be one of "row", "column", or "cell". This will highlight the row
or column of the current cell if it is set to "row" or "column". You
can control the color of the highlight with the SelectionBackColor
and SelectionForeColor properties.

     Not too bad of a response on a holiday, eh?

--

# p.d.

Nah, some people just like to do things the hard way - it's a macho thing! :wink:

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com

···

On Dec 27, 2005, at 12:20 PM, Peter Decker wrote:

I predict that some day the
dabo.ui will become the standard for wxPython!

Some people also have to maintain codebases written with wxPython.
Some employers don't like their employees rewriting code to use a
different library.
Some employers don't like to mix programming/UI development paradigms.
...

For me, Dabo isn't complete, and I don't have problems developing with
wxPython to start with. It makes sense to me.

- Josiah

···

Ed Leafe <ed@leafe.com> wrote:

On Dec 27, 2005, at 12:20 PM, Peter Decker wrote:

> I predict that some day the
> dabo.ui will become the standard for wxPython!

     Nah, some people just like to do things the hard way - it's a
macho thing! :wink:

And some people don't like libraries that hide the underlying interface

···

On Tuesday 27 December 2005 11:40, Josiah Carlson wrote:

Ed Leafe <ed@leafe.com> wrote:
> On Dec 27, 2005, at 12:20 PM, Peter Decker wrote:
> > I predict that some day the
> > dabo.ui will become the standard for wxPython!
>
> Nah, some people just like to do things the hard way - it's a
> macho thing! :wink:

Some people also have to maintain codebases written with wxPython.
Some employers don't like their employees rewriting code to use a
different library.
Some employers don't like to mix programming/UI development paradigms.
...

For me, Dabo isn't complete, and I don't have problems developing with
wxPython to start with. It makes sense to me.

- Josiah

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

--
  UC

--
Open Source Solutions 4U, LLC 1618 Kelly St
Phone: +1 707 568 3056 Santa Rosa, CA 95401
Cell: +1 650 302 2405 United States
Fax: +1 707 568 6416

     Nah, some people just like to do things the hard way - it's a
macho thing! :wink:

Some people also have to maintain codebases written with wxPython.
Some employers don't like their employees rewriting code to use a
different library.
Some employers don't like to mix programming/UI development paradigms.
...

     Wow, I thought the smiley would have sufficed to indicate I was joking. I guess I'll have to be careful not to attempt humor again.

For me, Dabo isn't complete, and I don't have problems developing with
wxPython to start with. It makes sense to me.

     And to many others, it's strong C++ flavor is decidedly un-Pythonic and thus a source for some confusion. If you enjoy programming with constants and getter/setter designs, then of course raw wxPython would be a better choice. But for those who would prefer to set a single property to get a desired behavior, or who prefer a simplified event model, or who prefer a consistent naming scheme, or who like binding a control's value to something else by setting two properties instead of writing a lot of code, Dabo's API would be more to their liking.

     And yes, Dabo is not complete. We've wrapped that part of wxPython that we needed to start, and since then have added other controls that users have requested. As more people start using Dabo, I expect the number of controls we wrap to increase steadily.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com

···

On Dec 27, 2005, at 2:40 PM, Josiah Carlson wrote:

Doesn't wxPython hide the underlying MFC, Gtk and Aqua interfaces? Isn't the whole point of the wxWidgets project to hide the details of each platform's UI interface?

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com

···

On Dec 27, 2005, at 2:45 PM, Uwe C. Schroeder wrote:

And some people don't like libraries that hide the underlying interface

yes - and you name it correctly: it hides platform dependent stuff, not
functionality that would be available otherwise.
Depending on what you want to achive dabo may be a choice - but it's
definitely not "THE" UI toolkit.

  UC

···

On Tuesday 27 December 2005 12:04, Ed Leafe wrote:

On Dec 27, 2005, at 2:45 PM, Uwe C. Schroeder wrote:
> And some people don't like libraries that hide the underlying
> interface

     Doesn't wxPython hide the underlying MFC, Gtk and Aqua
interfaces? Isn't the whole point of the wxWidgets project to hide
the details of each platform's UI interface?

--
Open Source Solutions 4U, LLC 1618 Kelly St
Phone: +1 707 568 3056 Santa Rosa, CA 95401
Cell: +1 650 302 2405 United States
Fax: +1 707 568 6416

yes - and you name it correctly: it hides platform dependent stuff, not
functionality that would be available otherwise.

     Oh, OK - I guess that that makes it clear: you've never worked with Dabo. Dabo classes are full wxPython subclasses, and you can call any method you like, whether from the Dabo layer or the wxPython layer. You don't lose anything that's in wxPython.

Depending on what you want to achive dabo may be a choice - but it's
definitely not "THE" UI toolkit.

     Again, it was a JOKE. Sorry to have touched such a raw nerve among some of you.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com

···

On Dec 27, 2005, at 3:32 PM, Uwe C. Schroeder wrote:

Some people don't have a sense of humor. :frowning:

···

On 12/27/05, Josiah Carlson <jcarlson@uci.edu> wrote:

Some people also have to maintain codebases written with wxPython.
Some employers don't like their employees rewriting code to use a
different library.
Some employers don't like to mix programming/UI development paradigms.

--

# p.d.

And some people like to criticize something they apparently know nothing about.

···

On 12/27/05, Uwe C. Schroeder <uwe@oss4u.com> wrote:

And some people don't like libraries that hide the underlying interface

--

# p.d.

Nope, I'm a known jerk. They even said as much during a toast at my
wedding. Also, I'm remoting the machine I'm emailing from at 1/2
resolution, so I can't always see punctuation (it's all barely
perceptable screen grit to me).

- Josiah

···

Peter Decker <pydecker@gmail.com> wrote:

On 12/27/05, Josiah Carlson <jcarlson@uci.edu> wrote:
> Some people also have to maintain codebases written with wxPython.
> Some employers don't like their employees rewriting code to use a
> different library.
> Some employers don't like to mix programming/UI development paradigms.

Some people don't have a sense of humor. :frowning:

Josiah Carlson wrote:

···

Peter Decker <pydecker@gmail.com> wrote:

On 12/27/05, Josiah Carlson <jcarlson@uci.edu> wrote:

Some people also have to maintain codebases written with wxPython.
Some employers don't like their employees rewriting code to use a
different library.
Some employers don't like to mix programming/UI development paradigms.

Some people don't have a sense of humor. :frowning:

Nope, I'm a known jerk. They even said as much during a toast at my
wedding. Also, I'm remoting the machine I'm emailing from at 1/2
resolution, so I can't always see punctuation (it's all barely
perceptable screen grit to me).

In which case it might be more sensible to refrain from responding until you are back at full resolution EXCLAMATION MARK SMILEY SMILEY

regards
  Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/