A list of all wx.CONSTANTS; available?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

A list of all wx.CONSTANTS; available?

TiNo-3
Often enough I need to know a wx constant, but I can't find them in the docs.
For example, I did not know if there was anything like
wx.LIST_AUTOSIZE. I had to find out by looking at the Demo. Wouldn't
it be nice to have these things in the docs? Because now I do not know
if there is another option for column sizing besides the autosize. And
I have no way to find out if ther is. Or do I miss a source?


Reply | Threaded
Open this post in threaded view
|

Re: A list of all wx.CONSTANTS; available?

Peter Damoc-2
try this:

import wx
fragment = "LIST"
for elem in dir(wx):
    if elem.isupper() and fragment in elem:
        print elem

Peter

On 11/30/06, TiNo <[hidden email]> wrote:
Often enough I need to know a wx constant, but I can't find them in the docs.
For example, I did not know if there was anything like
wx.LIST_AUTOSIZE. I had to find out by looking at the Demo. Wouldn't
it be nice to have these things in the docs? Because now I do not know
if there is another option for column sizing besides the autosize. And
I have no way to find out if ther is. Or do I miss a source?

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]




--
There is NO FATE, we are the creators.
Reply | Threaded
Open this post in threaded view
|

Re: A list of all wx.CONSTANTS; available?

TiNo-3
2006/11/30, Peter Damoc <[hidden email]>:
> try this:
>
> import wx
> fragment = "LIST"
> for elem in dir(wx):
>     if elem.isupper() and fragment in elem:
>         print elem
>
> Peter

Ah, jeah....

Question remains though. Isn't there anything else?
wx.LIST_AUTOSIZE.__doc__  is not very helpful for example:

'int(x[, base]) -> integer\n\nConvert a string or number to an
integer, if possible.  A floating point\nargument will be truncated
towards zero (this does not include a string\nrepresentation of a
floating point number!)  When converting a string, use\nthe optional
base.  It is an error to supply a base when converting a\nnon-string.
If the argument is outside the integer range a long object\nwill be
returned instead.'

The  API gives help on some items (such as wx.Mouse-class), mostly
quite sparse. This means I have to question this mailinglist alot.
Which works, but I'd rather look it up on the fly.

PHP has an exellent documentation for example. With space to comment
and discuss etc. Why isn't there something like that? (I guess because
it's a lot of work...) I feel quite limited in coding with wxpython
because their are no easy ways for me to find out how stuff works.
(Googling the terms, going through the immensly slow api, or asking
this list...)


Reply | Threaded
Open this post in threaded view
|

Re: A list of all wx.CONSTANTS; available?

Peter Decker
In reply to this post by TiNo-3
On 11/30/06, TiNo <[hidden email]> wrote:

> Often enough I need to know a wx constant, but I can't find them in the docs.
> For example, I did not know if there was anything like
> wx.LIST_AUTOSIZE. I had to find out by looking at the Demo. Wouldn't
> it be nice to have these things in the docs? Because now I do not know
> if there is another option for column sizing besides the autosize. And
> I have no way to find out if ther is. Or do I miss a source?

Can't help you with this, but here's a complete list of all the
constants you need to know in Dabo:


IMO, that's the optimal size for something like this: ZERO! If you
want to auto-size column 2 in a dListControl, you use:

ctl.autoSizeColumn(2)

And if you want to auto-size them all, you use:

ctl.autoSizeColumns()

I don't know about you, but I find the time I used to spend looking up
stuff like constants and other such stuff to be the major gain in
productivity I've had since I've moved my wxPython coding from raw
wxPython to Dabo's UI module.

--

# p.d.


Reply | Threaded
Open this post in threaded view
|

Re: A list of all wx.CONSTANTS; available?

Kevin Grover-2
In reply to this post by TiNo-3
I've had the same experience.  I just assumed that there was something that I had not yet figured out.

I used to use help(), but there's often so much ancillary information that it's nearly impossible to find what I want, then when I do find a function, there are no examples and I have to troll the demo.  I have a few cases where I could find not demos, so I gave up.  My development machine at work is on an isolated network (no Internet access at all), so if it's not in the online docs, or the demo, I have to go to another room to search the net.  This is an issue with the stock Python docs as well.  Sometimes I can find the docs, but unless you already understand want the function does and just need reference, you're out of luck without some example code.

One of the biggest helps would be some simple (even on-line) demos in the documentation.  Perhaps this could be embedded into the source and auto-extracted?

On 11/30/06, TiNo <[hidden email]> wrote:
2006/11/30, Peter Damoc < [hidden email]>:
> try this:
>
> import wx
> fragment = "LIST"
> for elem in dir(wx):
>     if elem.isupper() and fragment in elem:
>         print elem
>
> Peter

Ah, jeah....

Question remains though. Isn't there anything else?
wx.LIST_AUTOSIZE.__doc__  is not very helpful for example:

'int(x[, base]) -> integer\n\nConvert a string or number to an
integer, if possible.  A floating point\nargument will be truncated
towards zero (this does not include a string\nrepresentation of a
floating point number!)  When converting a string, use\nthe optional
base.  It is an error to supply a base when converting a\nnon-string.
If the argument is outside the integer range a long object\nwill be
returned instead.'

The  API gives help on some items (such as wx.Mouse-class), mostly
quite sparse. This means I have to question this mailinglist alot.
Which works, but I'd rather look it up on the fly.

PHP has an exellent documentation for example. With space to comment
and discuss etc. Why isn't there something like that? (I guess because
it's a lot of work...) I feel quite limited in coding with wxpython
because their are no easy ways for me to find out how stuff works.
(Googling the terms, going through the immensly slow api, or asking
this list...)

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: A list of all wx.CONSTANTS; available?

Chris Mellon
On 12/2/06, Kevin Grover <[hidden email]> wrote:

> I've had the same experience.  I just assumed that there was something that
> I had not yet figured out.
>
> I used to use help(), but there's often so much ancillary information that
> it's nearly impossible to find what I want, then when I do find a function,
> there are no examples and I have to troll the demo.  I have a few cases
> where I could find not demos, so I gave up.  My development machine at work
> is on an isolated network (no Internet access at all), so if it's not in the
> online docs, or the demo, I have to go to another room to search the net.
> This is an issue with the stock Python docs as well.  Sometimes I can find
> the docs, but unless you already understand want the function does and just
> need reference, you're out of luck without some example code.
>
> One of the biggest helps would be some simple (even on-line) demos in the
> documentation.  Perhaps this could be embedded into the source and
> auto-extracted?
>
> On 11/30/06, TiNo <[hidden email]> wrote:
> > 2006/11/30, Peter Damoc < [hidden email]>:
> > > try this:
> > >
> > > import wx
> > > fragment = "LIST"
> > > for elem in dir(wx):
> > >     if elem.isupper() and fragment in elem:
> > >         print elem
> > >
> > > Peter
> >
> > Ah, jeah....
> >
> > Question remains though. Isn't there anything else?
> > wx.LIST_AUTOSIZE.__doc__  is not very helpful for example:
> >
> > 'int(x[, base]) -> integer\n\nConvert a string or number to an
> > integer, if possible.  A floating point\nargument will be truncated
> > towards zero (this does not include a string\nrepresentation of a
> > floating point number!)  When converting a string, use\nthe optional
> > base.  It is an error to supply a base when converting a\nnon-string.
> > If the argument is outside the integer range a long object\nwill be
> > returned instead.'
> >
> > The  API gives help on some items (such as wx.Mouse-class), mostly
> > quite sparse. This means I have to question this mailinglist alot.
> > Which works, but I'd rather look it up on the fly.
> >
> > PHP has an exellent documentation for example. With space to comment
> > and discuss etc. Why isn't there something like that? (I guess because
> > it's a lot of work...) I feel quite limited in coding with wxpython
> > because their are no easy ways for me to find out how stuff works.
> > (Googling the terms, going through the immensly slow api, or asking
> > this list...)
> >
> >

The online docs at wxPython.org are autogenerated from the source, and
you can recreate them locally if you want.

This isn't really a "how do I find this constant" question though.
This is an API question, and you can find the answers you're looking
for in the wxWidgets docs, which lists the constants that any
particular call will take. help() on the constant itself won't tell
you anything of course - they're all either integers or strings, not
any sort of special enumerated type. You need to look at the help()
(or the doc, if the docstring isn't sufficent) for the call you're
trying to pass the constant to.



> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [hidden email]
> > For additional commands, e-mail:
> [hidden email]
> >
> >
>
>


Reply | Threaded
Open this post in threaded view
|

Re: A list of all wx.CONSTANTS; available?

TiNo-3
> This isn't really a "how do I find this constant" question though.
> This is an API question, and you can find the answers you're looking
> for in the wxWidgets docs, which lists the constants that any
> particular call will take.

Ah. That is a source I hadn't looked at yet.
Are all constants named the same in wxPython as they are in wxWidgets
(wxLIST_AUTOSIZE becoming wx.LIST_AUTOSIZE of course)?


Reply | Threaded
Open this post in threaded view
|

Re: A list of all wx.CONSTANTS; available?

Chris Mellon
On 12/4/06, TiNo <[hidden email]> wrote:
> > This isn't really a "how do I find this constant" question though.
> > This is an API question, and you can find the answers you're looking
> > for in the wxWidgets docs, which lists the constants that any
> > particular call will take.
>
> Ah. That is a source I hadn't looked at yet.
> Are all constants named the same in wxPython as they are in wxWidgets
> (wxLIST_AUTOSIZE becoming wx.LIST_AUTOSIZE of course)?
>

Yes.

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


Reply | Threaded
Open this post in threaded view
|

Re: A list of all wx.CONSTANTS; available?

Donn Ingle
In reply to this post by Peter Damoc-2
> import wx
> fragment = "LIST"
> for elem in dir(wx):
>     if elem.isupper() and fragment in elem:
>         print elem
Just for the record - I really loved this solution!

:D

/d



Reply | Threaded
Open this post in threaded view
|

Re: Re: A list of all wx.CONSTANTS; available?

Geradle
You can do this in another way using list comprehension
 
import wx
[elem for elem in dir(wx) if elem.isupper() and "LIST" in elem]

 
On 12/7/06, Donn Ingle <[hidden email]> wrote:
> import wx
> fragment = "LIST"
> for elem in dir(wx):
>     if elem.isupper () and fragment in elem:
>         print elem
Just for the record - I really loved this solution!

:D

/d


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]




--
邹邹
Reply | Threaded
Open this post in threaded view
|

Re: Re: A list of all wx.CONSTANTS; available?

Tom Plunket-3
Geradle wrote:

> You can do this in another way using list comprehension
>
> import wx
> [elem for elem in dir(wx) if elem.isupper() and "LIST" in elem]

print '\n'.join([elem for elem in dir(wx) if elem.isupper()])

(I haven't been subscribed long enough to understand why 'LIST' is part
of this discussion. ;) )

***

I actually use this sort of thing to notify me of unhandled events. E.g.
a menu handler:

class ...

  def OnWhatever(self, event):
    id = event.GetId()
    if id == something_known:
      pass
    elif ...
    else:
      d = vars(wx)
      for k, v in d.iteritems():
        if k.startswith('ID_') and v == id:
          id = k
          break
      print 'Unhandled event:', id


-tom!

--