Symbols, names and general confusion

Hi there,

i am creating a wx.Frame object, which i would like to center on the screen.

I do this:

configFrame=wx.Frame(self, -1, "Configuration", pos=wx.DefaultPosition)

First question:
where in the wx API documentation do i find a list of available symbols in regards of positioning a window?
I looked at the frame definition = nothing to be found, i looked at the window object = neither.

So what else is there than wx.DF

NOW:
it occurs to me that symbols (=wx.DefaultPosition) should be written uppercase. Yet it is not in the examples (wxPython Demos).
Furthermore, there seem to be at least 3 different types of spelling for the symbols: wx.DefaultPosition, wxDefaultPOsition, wx.DEFAULT_POSITION.

What gives???

Thanks for any insights,

Christophe Leske

Hi there,

i am creating a wx.Frame object, which i would like to center on the
screen.

I do this:

configFrame=wx.Frame(self, -1, "Configuration", pos=wx.DefaultPosition)

First question:
where in the wx API documentation do i find a list of available symbols
in regards of positioning a window?

you can use wx.Point(x, y) or simply pos = (x, y)

I looked at the frame definition = nothing to be found, i looked at the
window object = neither.

So what else is there than wx.DF

NOW:
it occurs to me that symbols (=wx.DefaultPosition) should be written
uppercase. Yet it is not in the examples (wxPython Demos).
Furthermore, there seem to be at least 3 different types of spelling for
the symbols: wx.DefaultPosition, wxDefaultPOsition, wx.DEFAULT_POSITION.

What gives???

Thanks for any insights,

Christophe Leske

wx.DefaultPosition is the right spelling.

If you start PyCrust, then you will see:

import wx
wx.DefaultPosition

wx.Point(-1, -1)

···

On Mon, 04 Jul 2005 13:37:39 +0200, Christophe Leske <leske@online.de> wrote:

--
Franz Steinhaeusler

wx.DefaultPosition is the right spelling.

Hallo Franz,

thanks for the hint that wx.DefaultPosition is the right spelling, but i was wondering if there are any other predefined symbols, maybe like wx.CenterOnScreen, wx.CenterV or something similar?

Also, how do i put a window in front of another?

Background: that frame of mine is supposed to be a configuration dialog, and it appears behind my main window.

Greets, Christophe Leske

where in the wx API documentation do i find a list of available symbols
in regards of positioning a window?
I looked at the frame definition = nothing to be found, i looked at the
window object = neither.

I'm late to this conversation, but I don't think your question was fully
answered.

The best source of documentation is the wxWidgets (C++) documentation on
wxwidgets.org. There is a nice CHM (Windows Help) version that you can
download. It points out differences between Python and C++.

The documentation on wxpython.org, under "New wxPyDocs", is helpful but
incomplete.

it occurs to me that symbols (=wx.DefaultPosition) should be written
uppercase. Yet it is not in the examples (wxPython Demos).
Furthermore, there seem to be at least 3 different types of spelling for
the symbols: wx.DefaultPosition, wxDefaultPOsition, wx.DEFAULT_POSITION.

Looking at http://wxwidgets.org/manuals/2.6.1/wx_wxframe.html, this symbol
is wxDefaultPosition.

In wxPython, we take advantage of Python's namespace scoping. In most cases
a symbol that begins with "wx" in the C++ library would be written as "wx."
in Python: wx.DefaultPosition.

To answer your specific question: there are not other choices for this
parameter. wx.DefaultPosition is really just a shortcut way of saying (-1,
-1), which tells the GUI or OS to select a default position.

Regards,
Nate

···

On 7/4/05 4:37 AM, "Christophe Leske" <leske@online.de> wrote:

I'm late to this conversation, but I don't think your question was fully
answered.

Thank you Nate. That answer was very complete and elaborate and exactly what i had hoped for.

One last thing:
none of these standard symbols are explained anywhere. How do you want people to know that wx.DefaultPosition is a synonym for wx.Point(-1,-1)?

Thanks to Nate and the others though. I like what i can do with wxPython, but i do not like the documentation that comes with it... :slight_smile:

Christophe Leske

You might want to take a look at Dabo. While Dabo is a full, 3-tier framework for developing apps that work with databases, the UI tier is self-contained, and wraps wxPython to provide a simpler, more straightforward way of working with UI elements. A lot of your questions and confusion seem to come from the C++ cruftiness that wxPython inherits from wxWidgets. Dabo gives you all the power of wxPython, but with a much more Pythonic API.

      ___/
     /
    __/
   /
  ____/
  Ed Leafe
  http://leafe.com/
  http://dabodev.com/

···

On Jul 4, 2005, at 10:43 AM, Christophe Leske wrote:

Thanks to Nate and the others though. I like what i can do with wxPython, but i do not like the documentation that comes with it... :slight_smile:

none of these standard symbols are explained anywhere. How do you want
people to know that wx.DefaultPosition is a synonym for wx.Point(-1,-1)?

(I'm actually just a developer who uses wxPython.)

The documentation doesn't say that directly but it gives enough clues: it
says the parameter is a wxPoint and that a value of (-1, -1) indicates a
default position.

Thanks to Nate and the others though. I like what i can do with
wxPython, but i do not like the documentation that comes with it... :slight_smile:

I agree, the documentation is the weak point, but wxPython is still a highly
productive environment.

Regards,
Nate

···

On 7/4/05 7:43 AM, "Christophe Leske" <leske@online.de> wrote:

I'm late to this conversation, but I don't think your question was fully
answered.

Thank you Nate. That answer was very complete and elaborate and exactly
what i had hoped for.

One last thing:
none of these standard symbols are explained anywhere. How do you want
people to know that wx.DefaultPosition is a synonym for wx.Point(-1,-1)?

As I said.
For trying out and playing, use Pycrust or DrPython's prompt.
Here you get (all possible) Code Completions.
This applies also for spe and Boa Constructor.
Also with Scite (if you start gen_python_api.py), you can
get (not optimum) code completition.

Thanks to Nate and the others though. I like what i can do with
wxPython, but i do not like the documentation that comes with it... :slight_smile:

If this (and the documentation) does not bring me any further,
always a good thing is to browse the demo and wxpython directory.
(I often use Total commanders text search or any other editor for search
in files).

If this does not help (I have downloaded the wxpython list contributions
for several month from the gmane newsserver) and make a text search in
this messages.

And this also don't give any results, you can look/ask in the wxwidgets
mailing list or newsgroup.

comp.soft-sys.wxwindows

···

On Mon, 04 Jul 2005 16:43:23 +0200, Christophe Leske <leske@online.de> wrote:

Christophe Leske

--
Franz Steinhaeusler

    You might want to take a look at Dabo. While Dabo is a full, 3-tier framework for developing apps that work with databases, the UI tier is self-contained, and wraps wxPython to provide a simpler, more straightforward way of working with UI elements. A lot of your questions and confusion seem to come from the C++ cruftiness that wxPython inherits from wxWidgets. Dabo gives you all the power of wxPython, but with a much more Pythonic API.

Thanks, but i am developing on Windows using Komodo Personal Edition. I am currently rather seeking a good UI tool. I heard wxGlade should be ok, but this has the same problem that wxPython: i don't seem to get it. I can't let it make what i want. I just want to design a simple dialog box, yet can't drop a slider in it there before i used a "stepper", whatever that is...

C

And of course not to forget to mention
http://wiki.wxpython.org/

···

On Mon, 04 Jul 2005 17:00:17 +0200, Franz Steinhäusler <franz.steinhaeusler@gmx.at> wrote:

And this also don't give any results, you can look/ask in the wxwidgets
mailing list or newsgroup.
http://www.solidsteel.nl/users/wxwidgets/
comp.soft-sys.wxwindows

--
Franz Steinhaeusler

Thanks, but i am developing on Windows using Komodo Personal Edition.

  That shouldn't be a problem.

I am currently rather seeking a good UI tool. I heard wxGlade should be ok, but this has the same problem that wxPython: i don't seem to get it. I can't let it make what i want. I just want to design a simple dialog box, yet can't drop a slider in it there before i used a "stepper", whatever that is...

  Here's what a simple dialog box with a slider looks like in Dabo:

class MyDialog(dabo.ui.dDialog):
  def addControls(self):
    self.slider = dabo.ui.dSlider(self, Min=0, Max=100, Value=42)
    self.Sizer.append(self.slider, 1, "x")

  That's it. The code, I believe, is much easier to read than standard wxPython code. Possibly the only cryptic thing is the shorthand in the sizer's append() call: the 'x' is a shorthand for "expand", which is the equivalent of passing wx.EXPAND to the wx.BoxSizer's flags parameter. The result of the code above would be a dialog with a slider that ranges from 0 to 100, with a default value of 42. The slider will fill the dialog.

  If you wanted a version of the above, but with the standard 'OK' and 'Cancel' buttons at the bottom, just inherit from dabo.ui.dOkCancelDialog instead.

  Since it is common to want to add controls to a dialog, we've built in an 'addControls()' method that is called at the appropriate point in the dialog's creation. Just put your code in that method, and you'll get the dialog you want.

      ___/
     /
    __/
   /
  ____/
  Ed Leafe
  http://leafe.com/
  http://dabodev.com/

···

On Jul 4, 2005, at 11:00 AM, Christophe Leske wrote: