Marlin Rowley wrote:
I want to start from the beginning and work my way to what I have now. Maybe then, I'll see some things that I didn't. 
Let's start with the Frame and Window creation. Right now, I pass a resolution into my script (rfxRenderView.py 320 240). Let's say it's 320x240. I expect this to be the resolution of the Window to be drawn upon, NOT the frame that includes all the widgets. However, this is exactly what is happening. The problem is that I call Frame's constructor in my own child frame and I pass it the size so that the window comes up relatively the size I want, however, the drawing window will be a little less than that because of the Menu bar. How do I pass the size of the Frame such that the Window gets created with 320x240, THEN the Frame builds around that (so the actually size of the frame+window > 320x240)?
The vocabulary here is "window size" (which includes the decorations)
and "client region" (which does not). Yes, when you specify a size,
that includes the decorations. You want to specify the size of the
client region, which you can't do, directly.
Although it is possible to compute the size of each of the decorations,
it is a tedious process, because of the possibility of themes. All the
edges can vary, so you end up fetching a whole bunch of system
preferences values. The easiest solution is to fetch your assigned
window size and your assigned client size, compute the difference, and
adjust yourself accordingly. For example, try adding the following
after you create the wx.Frame:
ws = self.GetSize()
cs = self.GetClientSize()
# Bump the window size by the delta between the two.
ws.IncBy( *(ws-cs) )
self.SetSize( ws )
···
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
First, in init, you build the Frame with
wx.Frame.__init__(self, parent = None, id = -1, title = 'yourtopframe')
without worrying about its size. Only then, when the frame exists, you add the command
self.SetClientSize(size)
···
2008/4/25, Marlin Rowley marlin_rowley@hotmail.com:
Where do you do this? Here is the calling init sequence for each of the classes in my script…
Window()
{
??
}
Frame() {
win = Window()
win.SetClientSize(size) <<<< – doesn’t work here!
}
App(){
frame = Frame()
??
}
Date: Fri, 25 Apr 2008 21:20:22 +0200
From: barbarossa.platz@gmail.com
To: wxpython-users@lists.wxwidgets.org
Subject: Re: [wxpython-users] Having problems with wxPython - HELP!!!
Try wxWindow.SetClientSize(width, height) or wxWindow.SetClientSize(size). The ‘decorations’ will adjust automatically.
2008/4/25, Tim Roberts timr@probo.com:
Marlin Rowley wrote:
I want to start from the beginning and work my way to what I have now. Maybe then, I’ll see some things that I didn’t. 
Let’s start with the Frame and Window creation. Right now, I pass a resolution into my script (rfxRenderView.py 320 240). Let’s say it’s 320x240. I expect this to be the resolution of the Window to be drawn upon, NOT the frame that includes all the widgets. However, this is exactly what is happening. The problem is that I call Frame’s constructor in my own child frame and I pass it the size so that the window comes up relatively the size I want, however, the drawing window will be a little less than that because of the Menu bar. How do I pass the size of the Frame such that the Window gets created with 320x240, THEN the Frame builds around that (so the actually size of the frame+window > 320x240)?
The vocabulary here is “window size” (which includes the decorations)
and “client region” (which does not). Yes, when you specify a size,
that includes the decorations. You want to specify the size of the
client region, which you can’t do, directly.
Although it is possible to compute the size of each of the decorations,
it is a tedious process, because of the possibility of themes. All the
edges can vary, so you end up fetching a whole bunch of system
preferences values. The easiest solution is to fetch your assigned
window size and your assigned client size, compute the difference, and
adjust yourself accordingly. For example, try adding the following
after you create the wx.Frame:
ws = self.GetSize()
cs = self.GetClientSize()
# Bump the window size by the delta between the two.
ws.IncBy( *(ws-cs) )
self.SetSize( ws )
–
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Make i’m yours. Create a custom banner to support your cause.
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Marlin Rowley wrote:
Where do you do this? Here is the calling __init__ sequence for each of the classes in my script..
Window()
{
??
}
Frame() {
win = Window()
win.SetClientSize(size) <<<< -- doesn't work here!
}
App(){
frame = Frame()
??
}
I'd do it at the frame level. Something like:
frame.SetClientsize(width, height)
I use the following call in one of my scripts to make the window the "best" size relative the controls that I have in it:
self.SetClientSize(panel.GetBestSize())
Not sure if that's relevant in this case though.
------------------------------------------------------------------------
Date: Fri, 25 Apr 2008 21:20:22 +0200
From: barbarossa.platz@gmail.com
To: wxpython-users@lists.wxwidgets.org
Subject: Re: [wxpython-users] Having problems with wxPython - HELP!!!
Try wxWindow.SetClientSize(width, height) or wxWindow.SetClientSize(size). The 'decorations' will adjust
automatically.
2008/4/25, Tim Roberts <timr@probo.com <mailto:timr@probo.com>>:
<snip>
Mike