I’m making my first attempt at using ObjectListView in an output form, and it’s driving me crazy. I’ve never really had a good understanding of sizers, but so far I’ve been able to make them work on my other panels. My application uses a single frame which hides and shows different panels as required, so all the header, size and color information comes from the parent frame. I only have 3 box sizers:
self.outersizer = wx.BoxSizer(wx.VERTICAL)
self.headersizer = wx.BoxSizer(wx.HORIZONTAL)
self.lowersizer = wx.BoxSizer(wx.VERTICAL)
I put the objectlistview in the lowersizer, but try as I might, I can’t get it to display more than three rows. I really don’t know if it’s a sizer problem or if I’ve missed something in the objectlistview constructor that keeps it from sizing properly.
I’ve attached a screen shot of the window with the listview on it, and a snippet of the code I used to put everything together. Maybe it will jump out at somebody, but for now, it’s making me feel very foolish.
Thanks for any advice!

sizercode.txt (2.29 KB)
Dave,
I am sure someone with more experience will chime in soon but for me the issue is not the grid but the sizers.
Sizers from my understanding are dynamic with basic instructions being feed them via standard variable name (something like wxBOTTOMLEFT, wxEXPAND, etc).
In order for your lower sizer to display more of the grid you need code to compress the upper and/or middle sizers (or what every is preventing it expanding) and have the lower one expand to take up the space. How are you trying to to this? What code are you using? What is the trigger to have the lower sizer change size?
Have you considered using a notebook with pages instead? You could hide and show the pages relatively easily.
Another thought, take one step back -- rather than ask how to get the sizers to work (possibly in a way they are not meant to work) maybe it would be better to outline your desired GUI design (e.g. header here, footer here, bore data here, dialog data to appear when bore data clicked, etc) and then fend off suggestions of how people would achieve this using the widgets available.
···
On 03/07/12 09:18, llanitedave wrote:
I'm making my first attempt at using ObjectListView in an output form,
and it's driving me crazy. I've never really had a good understanding
of sizers, but so far I've been able to make them work on my other
panels. My application uses a single frame which hides and shows
different panels as required, so all the header, size and color
information comes from the parent frame. I only have 3 box sizers:
self.outersizer = wx.BoxSizer(wx.VERTICAL)
self.headersizer = wx.BoxSizer(wx.HORIZONTAL)
self.lowersizer = wx.BoxSizer(wx.VERTICAL)
I put the objectlistview in the lowersizer, but try as I might, I can't
get it to display more than three rows. I really don't know if it's a
sizer problem or if I've missed something in the objectlistview
constructor that keeps it from sizing properly.
I've attached a screen shot of the window with the listview on it, and a
snippet of the code I used to put everything together. Maybe it will
jump out at somebody, but for now, it's making me feel very foolish.
Thanks for any advice!
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en
--
Cheers Simon
Simon Cropper - Open Content Creator / Website Administrator
Free and Open Source Software Workflow Guides
------------------------------------------------------------
Introduction http://www.fossworkflowguides.com
GIS Packages http://gis.fossworkflowguides.com
bash / Python http://scripting.fossworkflowguides.com
Well, I finally got the thing to display properly, so I should mark it as “solved”, but I won’t because I still don’t understand what’s going on.
What I did was to insert self.outersizer.SetMinSize((840,585)) below the final self.outersizer.Add() instruction. Fair enough, but the demo didn’t require anything of that nature, and my own objectlistview wasn’t really that much more complex.
Simon, my problem wasn’t that the upper sizer was being compressed. It was displaying perfectly normally. It’s that the lower one was stuck at a small height value for no discernable reason.
Well, I say the upper one was displaying normally, but in reality it didn’t seem to be following the wx.LEFT or wx.RIGHT instructions eithr. I just played with it until things lined up correctly, but I would probably have been just as well served using absolute positioning, since the app window will never change its size.
I’ve read the section on sizers in the wxPython book as well as the zetcode tutorials, and every time I think I almost understand them, they do something in practice that seems to make no sense. I have about 10 other windows in my application already built and displaying properly, but it’s more because I fiddled with them until they looked ok, not because I really understood what I was doing. I just don’t seem to be making much progress in really understanding them.
···
On Monday, July 2, 2012 5:36:30 PM UTC-7, Simon Cropper wrote:
On 03/07/12 09:18, llanitedave wrote:
I’m making my first attempt at using ObjectListView in an output form,
and it’s driving me crazy. I’ve never really had a good understanding
of sizers, but so far I’ve been able to make them work on my other
panels. My application uses a single frame which hides and shows
different panels as required, so all the header, size and color
information comes from the parent frame. I only have 3 box sizers:
self.outersizer = wx.BoxSizer(wx.VERTICAL)
self.headersizer = wx.BoxSizer(wx.HORIZONTAL)
self.lowersizer = wx.BoxSizer(wx.VERTICAL)
I put the objectlistview in the lowersizer, but try as I might, I can’t
get it to display more than three rows. I really don’t know if it’s a
sizer problem or if I’ve missed something in the objectlistview
constructor that keeps it from sizing properly.
I’ve attached a screen shot of the window with the listview on it, and a
snippet of the code I used to put everything together. Maybe it will
jump out at somebody, but for now, it’s making me feel very foolish.
Thanks for any advice!
–
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en
Dave,
I am sure someone with more experience will chime in soon but for me the
issue is not the grid but the sizers.
Sizers from my understanding are dynamic with basic instructions being
feed them via standard variable name (something like wxBOTTOMLEFT,
wxEXPAND, etc).
In order for your lower sizer to display more of the grid you need code
to compress the upper and/or middle sizers (or what every is preventing
it expanding) and have the lower one expand to take up the space. How
are you trying to to this? What code are you using? What is the trigger
to have the lower sizer change size?
Have you considered using a notebook with pages instead? You could hide
and show the pages relatively easily.
Another thought, take one step back – rather than ask how to get the
sizers to work (possibly in a way they are not meant to work) maybe it
would be better to outline your desired GUI design (e.g. header here,
footer here, bore data here, dialog data to appear when bore data
clicked, etc) and then fend off suggestions of how people would achieve
this using the widgets available.
–
Cheers Simon
Simon Cropper - Open Content Creator / Website Administrator
Free and Open Source Software Workflow Guides
------------------------------------------------------------
Introduction [http://www.fossworkflowguides.com](http://www.fossworkflowguides.com)
GIS Packages [http://gis.fossworkflowguides.com](http://gis.fossworkflowguides.com)
bash / Python [http://scripting.fossworkflowguides.com](http://scripting.fossworkflowguides.com)
Well, I finally got the thing to display properly, so I should mark it
as "solved", but I won't because I still don't understand what's going on.
That's great news.
What I did was to insert *self.outersizer.SetMinSize((840,585)) *below
the final *self.outersizer.Add()* instruction. Fair enough, but the
demo didn't require anything of that nature, and my own objectlistview
wasn't really that much more complex.
Simon, my problem wasn't that the upper sizer was being compressed. It
was displaying perfectly normally. It's that the lower one was stuck at
a small height value for no discernable reason.
Well, I say the upper one was displaying normally, but in reality it
didn't seem to be following the wx.LEFT or wx.RIGHT instructions eithr.
I just played with it until things lined up correctly, but I would
probably have been just as well served using absolute positioning, since
the app window will never change its size.
Have you tried (AKA subjected) your windows to different operating systems / fonts/ themes?
I can't remember whether you have indicated if you use windows or another operating system.
Your comments are very similar to comments I made when first programming with HTML+CSS. Then I tried different browsers on different OS and everything fell apart. If your application is only every to be used on a particular machine then absolute stuff would work but my understanding is that sizers make your code 'more' portable.
I've read the section on sizers in the wxPython book as well as the
zetcode tutorials, and every time I think I almost understand them, they
do something in practice that seems to make no sense. I have about 10
other windows in my application already built and displaying properly,
but it's more because I fiddled with them until they looked ok, not
because I really understood what I was doing. I just don't seem to be
making much progress in really understanding them.
I agree. I have recently created a simple question dialog box to test how wxPython renders a window and have found that it now behaves differently after changing the theme on my desktop. I now intend to do some tests myself to see how stable my trial apps are in different environments as I have a variety of machines using Windows and Ubuntu and want any application I create to be portable across platforms, desktop managers and themes.
[snip]
···
On 03/07/12 12:46, llanitedave wrote:
--
Cheers Simon
Simon Cropper - Open Content Creator
Free and Open Source Software Workflow Guides
------------------------------------------------------------
Introduction http://www.fossworkflowguides.com
GIS Packages http://www.fossworkflowguides.com/gis
bash / Python http://www.fossworkflowguides.com/scripting
I’m anticipating some formatting difficulties. I’m developing it on Ubuntu, but it will be used in the field on ruggedized Windows tablets. Unfortunately, they aren’t yet available, so I’ve just made sure the frame is small enough to fit on their screens. I’ll probably try it out on a Windows 7 laptop sometime next week, so I’ll get some hints then.
But that is one reason I’m struggling to understand sizers, because I want my adjustments to have to be minimal. Yeah, I’ve done a little bit of Mozilla/IE web app hell in the past, and it was no fun.
···
On Monday, July 2, 2012 8:41:43 PM UTC-7, Simon Cropper wrote:
On 03/07/12 12:46, llanitedave wrote:
Well, I finally got the thing to display properly, so I should mark it
as “solved”, but I won’t because I still don’t understand what’s going on.
That’s great news.
What I did was to insert *self.outersizer.SetMinSize((840,585)) *below
the final self.outersizer.Add() instruction. Fair enough, but the
demo didn’t require anything of that nature, and my own objectlistview
wasn’t really that much more complex.
Simon, my problem wasn’t that the upper sizer was being compressed. It
was displaying perfectly normally. It’s that the lower one was stuck at
a small height value for no discernable reason.
Well, I say the upper one was displaying normally, but in reality it
didn’t seem to be following the wx.LEFT or wx.RIGHT instructions eithr.
I just played with it until things lined up correctly, but I would
probably have been just as well served using absolute positioning, since
the app window will never change its size.
Have you tried (AKA subjected) your windows to different operating
systems / fonts/ themes?
I can’t remember whether you have indicated if you use windows or
another operating system.
Your comments are very similar to comments I made when first programming
with HTML+CSS. Then I tried different browsers on different OS and
everything fell apart. If your application is only every to be used on a
particular machine then absolute stuff would work but my understanding
is that sizers make your code ‘more’ portable.
I’ve read the section on sizers in the wxPython book as well as the
zetcode tutorials, and every time I think I almost understand them, they
do something in practice that seems to make no sense. I have about 10
other windows in my application already built and displaying properly,
but it’s more because I fiddled with them until they looked ok, not
because I really understood what I was doing. I just don’t seem to be
making much progress in really understanding them.
I agree. I have recently created a simple question dialog box to test
how wxPython renders a window and have found that it now behaves
differently after changing the theme on my desktop. I now intend to do
some tests myself to see how stable my trial apps are in different
environments as I have a variety of machines using Windows and Ubuntu
and want any application I create to be portable across platforms,
desktop managers and themes.
[snip]
–
Cheers Simon
Simon Cropper - Open Content Creator
Free and Open Source Software Workflow Guides
------------------------------------------------------------
Introduction [http://www.fossworkflowguides.com](http://www.fossworkflowguides.com)
GIS Packages [http://www.fossworkflowguides.com/gis](http://www.fossworkflowguides.com/gis)
bash / Python [http://www.fossworkflowguides.com/scripting](http://www.fossworkflowguides.com/scripting)
I'm anticipating some formatting difficulties. I'm developing it on
Ubuntu, but it will be used in the field on ruggedized Windows tablets.
Hey, I have done this! Well, created Visual Foxpro applications that I pushed to tablets. Look at my review, it might help when buying you hardware. Eail me direct if you have any questions.
http://www.botanicusaustralia.com.au/Technology.html
Unfortunately, they aren't yet available, so I've just made sure the
frame is small enough to fit on their screens. I'll probably try it out
on a Windows 7 laptop sometime next week, so I'll get some hints then.
Why not try using VirtualBox, then define the screen size to match you tablets? I actually use a XP Virtual machine to do all my programming in Visual Foxpro (trying to replace this development environment with Python+wxPython+SQLAlchemy but struggling with database-grid ).
This program is then pushed to a tablet for use in data collection and GIS analysis.
But that is one reason I'm struggling to understand sizers, because I
want my adjustments to have to be minimal. Yeah, I've done a little bit
of Mozilla/IE web app hell in the past, and it was no fun.
Then I suggest you definitely get a VM working to test you python app in both environments. This way you can avoid coming back later and fixing something that has a significant flow-on effect.
···
On 03/07/12 15:37, llanitedave wrote:
--
Cheers Simon
Simon Cropper - Open Content Creator
Free and Open Source Software Workflow Guides
------------------------------------------------------------
Introduction http://www.fossworkflowguides.com
GIS Packages http://www.fossworkflowguides.com/gis
bash / Python http://www.fossworkflowguides.com/scripting
I think this line:
self.lowersizer.Add(self.outputview, 0, wx.TOP|wx.EXPAND, 5)
should be changed to
self.lowersizer.Add(self.outputview, 1, wx.TOP|wx.EXPAND, 5)
That’s why it’s only expanding in one direction because the proportion was 0 in one of the sizers that contained the widget. If that doesn’t work, then there’s almost certainly a parenting issue of some sort and we’ll need a small runnable example to hack.
P.S. I don’t know if this will help or not, but I’ll plug it anyway: wxPython: Using ObjectListView instead of a ListCtrl - Mouse Vs Python
···
On Monday, July 2, 2012 6:18:02 PM UTC-5, llanitedave wrote:
I’m making my first attempt at using ObjectListView in an output form, and it’s driving me crazy. I’ve never really had a good understanding of sizers, but so far I’ve been able to make them work on my other panels. My application uses a single frame which hides and shows different panels as required, so all the header, size and color information comes from the parent frame. I only have 3 box sizers:
self.outersizer = wx.BoxSizer(wx.VERTICAL)
self.headersizer = wx.BoxSizer(wx.HORIZONTAL)
self.lowersizer = wx.BoxSizer(wx.VERTICAL)
I put the objectlistview in the lowersizer, but try as I might, I can’t get it to display more than three rows. I really don’t know if it’s a sizer problem or if I’ve missed something in the objectlistview constructor that keeps it from sizing properly.
I’ve attached a screen shot of the window with the listview on it, and a snippet of the code I used to put everything together. Maybe it will jump out at somebody, but for now, it’s making me feel very foolish.
Thanks for any advice!
Mike, I tried your suggestion, but it didn’t change anything. As for being a parent issue, I’ll try to distill an example from just the relevant code this weekend. (Unfortunately, my coding moments are precious and few) Off the top of my head, though, I don’t see how it could be, since the parent is a frame that has no layout (other than a size) of its own. All the sizers are in the panels, and only one panel at a time is displayed.
BTW, I’ve already had your blog bookmarked for a few weeks now. I used your tips on wxgrid in constructing one of my own, and your bit on objectlist view was part of what helped me decide to use that instead of a regular listcontrol. Your blog is a wonderful supplement to Robin’s wxPython book, so I don’t mind you plugging it here at all.
Simon, we already have the tablets on hand, but I’m not the guy in charge of configuring them, and they’ll basically be ready when he’s done with them. In the meantime, all I have to do is get Python Path resolved on my Windows partition so that it sees ObjectListView. I’ll be trying to get to that this weekend as well.
···
On Tuesday, July 3, 2012 7:25:54 AM UTC-7, Mike Driscoll wrote:
On Monday, July 2, 2012 6:18:02 PM UTC-5, llanitedave wrote:
I’m making my first attempt at using ObjectListView in an output form, and it’s driving me crazy. I’ve never really had a good understanding of sizers, but so far I’ve been able to make them work on my other panels. My application uses a single frame which hides and shows different panels as required, so all the header, size and color information comes from the parent frame. I only have 3 box sizers:
self.outersizer = wx.BoxSizer(wx.VERTICAL)
self.headersizer = wx.BoxSizer(wx.HORIZONTAL)
self.lowersizer = wx.BoxSizer(wx.VERTICAL)
I put the objectlistview in the lowersizer, but try as I might, I can’t get it to display more than three rows. I really don’t know if it’s a sizer problem or if I’ve missed something in the objectlistview constructor that keeps it from sizing properly.
I’ve attached a screen shot of the window with the listview on it, and a snippet of the code I used to put everything together. Maybe it will jump out at somebody, but for now, it’s making me feel very foolish.
Thanks for any advice!
I think this line:
self.lowersizer.Add(self.outputview, 0, wx.TOP|wx.EXPAND, 5)
should be changed to
self.lowersizer.Add(self.outputview, 1, wx.TOP|wx.EXPAND, 5)
That’s why it’s only expanding in one direction because the proportion was 0 in one of the sizers that contained the widget. If that doesn’t work, then there’s almost certainly a parenting issue of some sort and we’ll need a small runnable example to hack.
P.S. I don’t know if this will help or not, but I’ll plug it anyway: http://www.blog.pythonlibrary.org/2009/12/23/wxpython-using-objectlistview-instead-of-a-listctrl/
Mike, I tried your suggestion, but it didn’t change anything. As for being a parent issue, I’ll try to distill an example from just the relevant code this weekend. (Unfortunately, my coding moments are precious and few) Off the top of my head, though, I don’t see how it could be, since the parent is a frame that has no layout (other than a size) of its own. All the sizers are in the panels, and only one panel at a time is displayed.
Hmmm. Weird. I think I’d need a small runnable example to know what’s going on at this point.
BTW, I’ve already had your blog bookmarked for a few weeks now. I used your tips on wxgrid in constructing one of my own, and your bit on objectlist view was part of what helped me decide to use that instead of a regular listcontrol. Your blog is a wonderful supplement to Robin’s wxPython book, so I don’t mind you plugging it here at all.
Thanks!
Simon, we already have the tablets on hand, but I’m not the guy in charge of configuring them, and they’ll basically be ready when he’s done with them. In the meantime, all I have to do is get Python Path resolved on my Windows partition so that it sees ObjectListView. I’ll be trying to get to that this weekend as well.
When you install a new module correctly on Windows, it should be added to Python’s search path automatically. Are you talking about just adding the Python path itself to Windows? I’ve got a tutorial on that here: http://www.blog.pythonlibrary.org/2011/11/24/python-101-setting-up-python-on-windows/
···
On Thursday, July 5, 2012 11:10:26 PM UTC-5, llanitedave wrote: