wx.TreeCtrl automatic expansion/scrollable?

Attached is my test code - effectively, while have got most of use/functionality of TreeCtrl figured out in terms of what want to do with it in terms of data/functionality, etc., the issue now is am not sure if the TreeCtrl element will resize it’s display dimensions if, for example, the overall window is maximised, etc., and have tried placing it inside a BoxSizer, etc., but am just not sure it’s cooperating exactly, since can’t ‘look’ at it myself, so thought could pass code on, and, let me know?

Effectively, would just want it to resize it’s overall display area as it’s sort of container panel/sizer element is resized, and hope am at least trying to implement it right in the code attached.

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
“Roger Wilco wants to welcome you…to the space janitor’s closet…”

myTreeTest.py (6.57 KB)

Hi. There are a few things a bit wrong about your code.

  1. You don’t import wx.lib.scrolledpanel, so the code as provided doesn’t run. You have to import that at the start.

  2. For future requests, please try to make your sample applications much simpler. This code is 160 lines long to really test whether a tree control expands. You could do this in probably a third of the code. This makes it easier for others to help you, but more importantly, it often makes it far easier for you to discover what the issue is (at least I have certainly found that to be the case. Often I create a small sample app and never post it to the list because I notice what the issue is before then due to creating this pared down version of the issue). I would also give the object’s names somewhat more readable and understandable names, so instead of vBoxTC I might bother to write out treeCtrl_vBoxSizer. I find this less cryptic naming easier to read what’s going on in the code.

  3. When the sample was run, the tree control wasn’t showing up at all other than a small white square with the root text in it. The problem was that you have to set the sizer that the tree control is in to also have the wx.EXPAND flag and also set the proportion = 1. So that line should be:

vBox.Add(vBoxTC, 1, flag=wx.EXPAND | wx.ALIGN_CENTER | wx.CENTER | wx.ALL, border=10)

There may be a few other things wrong here, but I’m not sure.

Hope this helps,
Che

···

On Sun, Mar 9, 2014 at 4:03 AM, Jacob Kruger jacob@blindza.co.za wrote:

Attached is my test code - effectively, while have got most of use/functionality of TreeCtrl figured out in terms of what want to do with it in terms of data/functionality, etc., the issue now is am not sure if the TreeCtrl element will resize it’s display dimensions if, for example, the overall window is maximised, etc., and have tried placing it inside a BoxSizer, etc., but am just not sure it’s cooperating exactly, since can’t ‘look’ at it myself, so thought could pass code on, and, let me know?

Effectively, would just want it to resize it’s overall display area as it’s sort of container panel/sizer element is resized, and hope am at least trying to implement it right in the code attached.

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
“Roger Wilco wants to welcome you…to the space janitor’s closet…”

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Sorry - yes, it was a rather quick, slap-together bit of testing, but, it did run here.

Will try out adding all the other arguments/parameters - thanks again.

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
“Roger Wilco wants to welcome you…to the space janitor’s closet…”

···

----- Original Message -----

From:
C M

To: wxpython-users@googlegroups.com

Sent: Sunday, 09 March, 2014 7:23 PM

Subject: Re: [wxPython-users] wx.TreeCtrl automatic expansion/scrollable?

Hi. There are a few things a bit wrong about your code.

  1. You don’t import wx.lib.scrolledpanel, so the code as provided doesn’t run. You have to import that at the start.
  1. For future requests, please try to make your sample applications much simpler. This code is 160 lines long to really test whether a tree control expands. You could do this in probably a third of the code. This makes it easier for others to help you, but more importantly, it often makes it far easier for you to discover what the issue is (at least I have certainly found that to be the case. Often I create a small sample app and never post it to the list because I notice what the issue is before then due to creating this pared down version of the issue). I would also give the object’s names somewhat more readable and understandable names, so instead of vBoxTC I might bother to write out treeCtrl_vBoxSizer. I find this less cryptic naming easier to read what’s going on in the code.
  1. When the sample was run, the tree control wasn’t showing up at all other than a small white square with the root text in it. The problem was that you have to set the sizer that the tree control is in to also have the wx.EXPAND flag and also set the proportion = 1. So that line should be:

vBox.Add(vBoxTC, 1, flag=wx.EXPAND | wx.ALIGN_CENTER | wx.CENTER | wx.ALL, border=10)

There may be a few other things wrong here, but I’m not sure.

Hope this helps,
Che

On Sun, Mar 9, 2014 at 4:03 AM, Jacob Kruger jacob@blindza.co.za wrote:

Attached is my test code - effectively, while have got most of use/functionality of TreeCtrl figured out in terms of what want to do with it in terms of data/functionality, etc., the issue now is am not sure if the TreeCtrl element will resize it's display dimensions if, for example, the overall window is maximised, etc., and have tried placing it inside a BoxSizer, etc., but am just not sure it's cooperating exactly, since can't 'look' at it myself, so thought could pass code on, and, let me know?
Effectively, would just want it to resize it's overall display area as it's sort of container panel/sizer element is resized, and hope am at least trying to implement it right in the code attached.

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
“Roger Wilco wants to welcome you…to the space janitor’s closet…”


You received this message because you are subscribed to the Google Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Another silly question - why does import wx not then invoke/include the same effect as import wx.lib.scrolledpanel?

As in, why do you need to specify the import of both wx and wx.lib.scrolledpanel separately?

As in, why does the import of wx module not include/invoke the importing of what seems to fall under it as a form of child module?

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
“Roger Wilco wants to welcome you…to the space janitor’s closet…”

···

----- Original Message -----

From:
Jacob Kruger

To: wxpython-users@googlegroups.com

Sent: Sunday, 09 March, 2014 7:57 PM

Subject: Re: [wxPython-users] wx.TreeCtrl automatic expansion/scrollable?

Sorry - yes, it was a rather quick, slap-together bit of testing, but, it did run here.

Will try out adding all the other arguments/parameters - thanks again.

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
“Roger Wilco wants to welcome you…to the space janitor’s closet…”

----- Original Message -----

From:
C M

To: wxpython-users@googlegroups.com

Sent: Sunday, 09 March, 2014 7:23 PM

Subject: Re: [wxPython-users] wx.TreeCtrl automatic expansion/scrollable?

Hi.  There are a few things a bit wrong about your code.
1. You don't import wx.lib.scrolledpanel, so the code as provided doesn't run.  You have to import that at the start.
2. For future requests, please try to make your sample applications much simpler.  This code is 160 lines long to really test whether a tree control expands.  You could do this in probably a third of the code.  This makes it easier for others to help you, but more importantly, it often makes it far easier for you to discover what the issue is (at least I have certainly found that to be the case.  Often I create a small sample app and never post it to the list because I notice what the issue is before then due to creating this pared down version of the issue).  I would also give the object's names somewhat more readable and understandable names, so instead of vBoxTC I might bother to write out treeCtrl_vBoxSizer.  I find this less cryptic naming easier to read what's going on in the code.
3. When the sample was run, the tree control wasn't showing up at all other than a small white square with the root text in it.  The problem was that you have to set the sizer that the tree control is in to also have the wx.EXPAND flag and also set the proportion = 1.  So that line should be:

vBox.Add(vBoxTC, 1, flag=wx.EXPAND | wx.ALIGN_CENTER | wx.CENTER | wx.ALL, border=10)
There may be a few other things wrong here, but I'm not sure. 

Hope this helps,
Che

On Sun, Mar 9, 2014 at 4:03 AM, Jacob Kruger jacob@blindza.co.za wrote:

  Attached is my test code - effectively, while have got most of use/functionality of TreeCtrl figured out in terms of what want to do with it in terms of data/functionality, etc., the issue now is am not sure if the TreeCtrl element will resize it's display dimensions if, for example, the overall window is maximised, etc., and have tried placing it inside a BoxSizer, etc., but am just not sure it's cooperating exactly, since can't 'look' at it myself, so thought could pass code on, and, let me know?
  Effectively, would just want it to resize it's overall display area as it's sort of container panel/sizer element is resized, and hope am at least trying to implement it right in the code attached.

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
“Roger Wilco wants to welcome you…to the space janitor’s closet…”


You received this message because you are subscribed to the Google Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

This is a general point of Python package importing, and a good answer to
it is given by Ben here:

The same point applies to the AGW widgets from Andrea Gavana, in which you
have to import them by, for example (taken from the demo):

try:
    from agw import ultimatelistctrl as ULC
except ImportError: # if it's not there locally, try the wxPython lib.
    from wx.lib.agw import ultimatelistctrl as ULC

HTH,
Che

···

On Sun, Mar 9, 2014 at 5:00 PM, Jacob Kruger <jacob@blindza.co.za> wrote:

Another silly question - why does import wx not then invoke/include the
same effect as import wx.lib.scrolledpanel?

As in, why do you need to specify the import of both wx and
wx.lib.scrolledpanel separately?

As in, why does the import of wx module not include/invoke the importing
of what seems to fall under it as a form of child module?