I was considering adding or showing more then one toolbar dynamically based on a checkbox or some other condition. But I wanted to start just showing one toolbar to test. So I copied the multi- toolbar example just leaving off other toolbars for a minute. I ran my code which has a sizer attached to the wx.frame. The sizer included just the one toolbar. And ran the code. A visual behavior I’ve seen before cropped up. The single toolbar was precisely one toolbar length further down from the titlebar then it should be.
Did I code it wrong - meaning missed typed something? or
Is my logic wrong? or
Is there some “for-loop” issue in the underlying wx library when using just one item in a sizer in a frame?
Code attached. The attached icons I pulled from a icon sharing webside where the license requirements were -explicidly- not specified.
I’ve included a screen shot as well.
This was run with Python 2.7, wxPython '2.8.11.0 (msw-unicode) on Windows XP SP3.
I’m sure I can come up with solutions or work arounds. I was wondering if this is a bug or this graphical behavior is an intended thing or is working as expected.
I was considering adding or showing more then one toolbar dynamically based
on a checkbox or some other condition. But I wanted to start just showing
one toolbar to test. So I copied the multi- toolbar example just leaving off
other toolbars for a minute. I ran my code which has a sizer attached to the
wx.frame. The sizer included just the one toolbar. And ran the code. A
visual behavior I've seen before cropped up. The single toolbar was
precisely one toolbar length further down from the titlebar then it should
be.
1. Did I code it wrong - meaning missed typed something? or
2. Is my logic wrong? or
3. Is there some "for-loop" issue in the underlying wx library when using
just one item in a sizer in a frame?
Don't put the ToolBar in the sizer. The Frame will manage the Toolbar
on its own when you use CreateToolbar or SetToolBar on the Frame.
But if later I want to add more toolbars at run time? Should I not put them in a sizer? or will all the toolbars added to the frame and then shown or hidden by the user be managed by the frame itself?
If toolbars (specifically plurual) should not be managed by a sizer then the website I mentioned in my original post is misleading.
Of course my intent is more involved then just multiple toolbars. I was considering the new ribbons as an exploration in UI usability.
On Tue, Nov 30, 2010 at 4:04 PM, Dev Player <devplayer@gmail.com> wrote:
But if later I want to add more toolbars at run time? Should I not put them
in a sizer? or will all the toolbars added to the frame and then shown or
hidden by the user be managed by the frame itself?
If toolbars (specifically plurual) should not be managed by a sizer then the
website I mentioned in my original post is misleading.
Of course my intent is more involved then just multiple toolbars. I was
considering the new ribbons as an exploration in UI usability.
In that case don't use the Frame's CreateToolBar method as that
allocates space in the frame for the toolbar. Just use the regular
ToolBar constructor to create a ToolBar object.
self.toolbar = wx.ToolBar(self)
Then you can manage the layout yourself with sizers.
But if later I want to add more toolbars at run time? Should I not put them
in a sizer? or will all the toolbars added to the frame and then shown or
hidden by the user be managed by the frame itself?
If toolbars (specifically plurual) should not be managed by a sizer then the
website I mentioned in my original post is misleading.
I wrote that some years ago -- something may have changed. Do please update it if you do find errors.
Of course my intent is more involved then just multiple toolbars. I was
considering the new ribbons as an exploration in UI usability.
In that case don't use the Frame's CreateToolBar method as that
allocates space in the frame for the toolbar. Just use the regular
ToolBar constructor to create a ToolBar object.
I don't think CreateToolBar() is in that sample code -- please fix it if it is.
-Chris
···
On 11/30/10 2:14 PM, Cody Precord wrote:
On Tue, Nov 30, 2010 at 4:04 PM, Dev Player<devplayer@gmail.com> wrote:
--
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
Just curious. When you say that CreateToolBar() allocates space for the toolbar window, does it do this by modifying the usable client area rect of the window?
Just curious. When you say that CreateToolBar() allocates space for the
toolbar window, does it do this by modifying the usable client area rect of
the window?
Yes, the Frames DoGetClientSize accommodates for a toolbar and/or
statusbar if one was set on the frame with the associated
SetToolBar/SetStatusBar methods.
The frame can automatically manage one of each kind of "bar", MenuBar, ToolBar, and StatusBar. When you use the frame.Set*Bar() method to give it one of the bars then the frame will automatically position and size the bar as needed, and yes, it does adjust the client area of the frame to do it (so the client area position 0,0 is always just below the menubar and/or toolbar if they are present.) If you need more than the one toolbar then you'll need to manage the layout of the others yourself.
···
On 11/30/10 3:27 PM, Dev Player wrote:
Just curious. When you say that CreateToolBar() allocates space for the
toolbar window, does it do this by modifying the usable client area rect
of the window?
My error. The website uses wx.ToolBar and not wx.CreateToolBar for the
multi-toolbar example.
--
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
I'd love to see more of your tutorials! I love your layout. It was
clear, inspite of my oversite.
--
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