Website examples and style guide

Hi guys,

Wow, the website examples should *really* be updated to fit the style guide. All week I've been telling my wife that WX looks crappy compared Gtk because you have to use IDs everywhere. Reading the style guide, it turns out that this is deprecated and now there is a better way to do it. So, for example, this:

ID_TEXT_BOX = 100 # Global variable!
...
searchTextBox = wx.TextCtrl(panel, ID_TEXT_BOX)
self.Bind(wx.EVT_TEXT, self.onEnterText, None, ID_TEXT_BOX)

Becomes:

searchTextBox = wx.TextCtrl(panel)
mySizer.Add(searchTextBox)

The issue is not even that the second form it's shorter. The issue is that global variables are evil, and having to setup a list of IDs feels almost like using GOTOs.

So all along I've been thinking that wxPython is worse than it really is. That's not the impression you want to give.

Cheers,
Daniel.

Daniel Carrera wrote:

Wow, the website examples should *really* be updated to fit the style guide.

When you say "website" do you mean "wiki"?

If so, then yes, it would be great to update as much as possible -- it's a Wiki -- please do what you can!

Also, the main demo has only been partially updated -- patches for that would be gladly accepted as well.

So all along I've been thinking that wxPython is worse than it really is. That's not the impression you want to give.

No, but someone has to do the work!

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Christopher Barker wrote:

Daniel Carrera wrote:

Wow, the website examples should *really* be updated to fit the style guide.

When you say "website" do you mean "wiki"?

If so, then yes, it would be great to update as much as possible -- it's a Wiki -- please do what you can!

Yeah, actually. It didn't "click" that it was a wiki. I might make some edits later (but I'm just a noob...).

Daniel.

I usually use wx.ID_ANY in that field for my tutorials to help the new
programmers know how everything fits together. Lately I have been
dropping this somewhat when helping people on the IRC channel because
it's quicker to type.

If you have the time, make a list of the pages that need work and we
can split it and fix them that way. I'm reviewing a book at the
moment, but I can probably work on this with you.

···

On Jan 13, 12:18 pm, Daniel Carrera <dcarr...@gmail.com> wrote:

Hi guys,

Wow, the website examples should *really* be updated to fit the style
guide. All week I've been telling my wife that WX looks crappy compared
Gtk because you have to use IDs everywhere. Reading the style guide, it
turns out that this is deprecated and now there is a better way to do
it. So, for example, this:

ID_TEXT_BOX = 100 # Global variable!
...
searchTextBox = wx.TextCtrl(panel, ID_TEXT_BOX)
self.Bind(wx.EVT_TEXT, self.onEnterText, None, ID_TEXT_BOX)

Becomes:

searchTextBox = wx.TextCtrl(panel)
mySizer.Add(searchTextBox)

The issue is not even that the second form it's shorter. The issue is
that global variables are evil, and having to setup a list of IDs feels
almost like using GOTOs.

So all along I've been thinking that wxPython is worse than it really
is. That's not the impression you want to give.

Cheers,
Daniel.

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

PyCon 2010 Atlanta Feb 19-21 http://us.pycon.org/