wxPython - wx package (new style wxPython?)

L

Logan

Would you recommend to use the wx package of wxPython?

From the documentation:

Provides a way to drop the wx prefix from wxPython objects by
dynamically loading and renaming objects from the real wxPython
package. This is the first phase of a transition to a new style
of using wxPython. For example:

import wx
class MyFrame(wx.Frame):
...

instead of:

from wxPython.wx import *
class MyFrame(wxFrame):
...

What does 'this is the first phase of a transition to a new style
using wxPython' in the above mean? Will this new style become the
only way to use wxPython in future releases?

Thanks in advance for any answers.
 
B

Ben Finney

Would you recommend to use the wx package of wxPython?

Because it removes the redundancy in the module object names, yes. As
for any other qualities the 'wx' package might have, I can't say; if
it's exactly the same functionality and call styles as the existing
wxPython.wx then I can't see a reason not to use it.
From the documentation:

Provides a way to drop the wx prefix from wxPython objects by
dynamically loading and renaming objects from the real wxPython
package. This is the first phase of a transition to a new style
of using wxPython.

What does 'this is the first phase of a transition to a new style
using wxPython' in the above mean? Will this new style become the
only way to use wxPython in future releases?

'from foo import *' is heavily deprecated in any case; this "new style
of using wxPython" is merely saying (AIUI) that the 'wx' package allows
a more natural usage of wxPython objects without needing to use a
deprecated import style.
 
J

James Tanis

Bah, I think they are just over-glorifying the change. In my
mind, it's the same exact thing. The only real different is when you
"from wxPython.wx import *" it reads everything into your local
namespace which is traditionally considered not the best thing to do.
I really have no idea if the "transition" when finished will remain
backwards compatible, but I'm guessing from the description of the
implementation that it is.

BTW, In the future you may want to use a real email address so that you
can receive an answer.
 
L

Logan

BTW, In the future you may want to use a real email address
so that you can receive an answer.

Thanks for your comments regarding my question.

About the 'real email address':

I do use a real address! You can find the address in the
signatures of my postings; just remove the part saying '(NoSpam)'.

I don't use the real address in the headers of my postings
(but: (e-mail address removed)) because the last time (about a
month ago) I used my real address, I got thousands and thousands
of SPAM mails, viruses etc. per week. This was really annoying.
 
M

Mark Hahn

I just finished a moderate sized wxPython app from scratch using wx and I'm
happy I did. There were a few times I had to put my thinking cap on, but it
worked out well.
 
D

David Bolen

James Tanis said:
Bah, I think they are just over-glorifying the change. In my
mind, it's the same exact thing. The only real different is when you
"from wxPython.wx import *" it reads everything into your local
namespace which is traditionally considered not the best thing to do.
I really have no idea if the "transition" when finished will remain
backwards compatible, but I'm guessing from the description of the
implementation that it is.

To be honest, for a while now I've often been doing:

from wxPython import wx

and putting up with duplicated references to wx (e.g., wx.wxWindow).
That avoids both the pollution of the local namespace and the overhead
of pulling in the several thousand names (I got a noticeable
performance speed up in an application with many plugins since each
plugin no longer needed to make extra references for all the wx
objects in the plugin's local namespace).

One reason why I haven't moved to the new wx package yet is that it's
implemented as a lazy evaluation approach (probably for performance),
which means it doesn't play nice with interface tools that need
introspection (e.g., IDE completion) which some of my other developers
use. Once wx becomes a full fledged normal module I'd definitely
consider moving to it for the same reasons that I use the above
approach now.

-- David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top