Hi
I need to generate a set of simple data entry widgets (such as textctrl or radiobox or checkbutton) that will reflect the properties of an item, and then stack the widgets within say a vertical box
However, the actual widgets shown within the enclosing sizer is dynamic, depending on the particular choice of say, a radiobutton or combo box (with predefined values).
An example will illustrate this.
Say we want to display some widgets defining an item of type VEHICLES. We consider that there are only two sub-types of vehicles, cars and bikes.
If the user chooses “car” from a combo or radiobox, then the following widgets would be:
- engine capacity
- color
- date of manufacture
If the user had chosen “bike”, the following widgets would be:
- tire size
- color
- date of manufacture
This idea is extended every time a combo/check/radio type widget is encountered.
If I needed to do this only once, ie for VEHICLES (cars and bikes), I could easily hard code. However, this idea must be repeated many times for different sorts of items, not just vehicles.
Each time a radio/combo/check is encountered, the user choice MAY influence which entry widgets follow.
So I am looking for a pythonic, generic way of doing this, starting from some sort of (simple) data structure that would embody the rules.
Any ideas welcome.
(Thanks to all who make python and wxpython such great tools)
David
Hi David,
Hi
I need to generate a set of simple data entry widgets (such as textctrl or radiobox or checkbutton) that will reflect the properties of an item, and then stack the widgets within say a vertical box
However, the actual widgets shown within the enclosing sizer is dynamic, depending on the particular choice of say, a radiobutton or combo box (with predefined values).
An example will illustrate this.
Say we want to display some widgets defining an item of type VEHICLES. We consider that there are only two sub-types of vehicles, cars and bikes.
If the user chooses “car” from a combo or radiobox, then the following widgets would be:
- engine capacity
- color
- date of manufacture
If the user had chosen “bike”, the following widgets would be:
- tire size
- color
- date of manufacture
This idea is extended every time a combo/check/radio type widget is encountered.
If I needed to do this only once, ie for VEHICLES (cars and bikes), I could easily hard code. However, this idea must be repeated many times for different sorts of items, not just vehicles.
Each time a radio/combo/check is encountered, the user choice MAY influence which entry widgets follow.
So I am looking for a pythonic, generic way of doing this, starting from some sort of (simple) data structure that would embody the rules.
Any ideas welcome.
(Thanks to all who make python and wxpython such great tools)
David
One approach would be to have a dictionary of dictionaries. Something like this:
vehicles = {‘bike’:{‘tire_size’: widget,
‘color’: widget,
‘date_of_manufacture’: widget}
‘car’:{‘engine’: widget}
}
The “widget” portion can actually be an instance of a widget or you could just use a string and create the widgets later. I would lean a bit towards the latter.
I hope that gives you some ideas.
Mike
···
On Monday, November 10, 2014 2:14:15 AM UTC-6, David Wende wrote:
David Wende wrote:
If I needed to do this only once, ie for VEHICLES (cars and bikes), I
could easily hard code. However, this idea must be repeated many times
for different sorts of items, not just vehicles.
Each time a radio/combo/check is encountered, the user choice MAY
influence which entry widgets follow.
So I am looking for a pythonic, generic way of doing this, starting
from some sort of (simple) data structure that would embody the rules.
Consider how you might represent this in a disk file:
vehicle
car
body style
coupe
4 door
2 door
sedan
wagon
engine capacity
color
date of manufacture
bicycle
tire size
color
date of manufacture
One thing that strikes me here is that some of these need different
types of input fields. Engine capacity and color, for example, need a
text box for arbitrary text entry. You'll have to figure out how to
represent that.
After that, figuring out the data structure isn't too hard. At the
['vehicle'] level, you'll generate radio buttons or combo box for the
current children. As one child is selected, you'll add more radio
buttons for the children of that selection.
···
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
Thanks Mike and Tim for your ideas.
I think that in initially generating and displaying the widgets I can easily follow such simple structures as you mentioned.
The part where I get lost is:
Once the widgets are displayed (using a default type such as “car”), I must react dynamically such that if the user then
changes his choice to bikes, the displayed widgets update automatically. There may be more than a single “choice” widget
in a complete tree, and this “choice” widget may affect one or more downstream widgets.
As I said, I could pretty easily hard-code this for “vehicles”, but the idea must be generic in that it should be applicable to
such things as “plants” etc based on my input data structure.
Thanks again.
···
On Monday, November 10, 2014 10:14:15 AM UTC+2, David Wende wrote:
Hi
I need to generate a set of simple data entry widgets (such as textctrl or radiobox or checkbutton) that will reflect the properties of an item, and then stack the widgets within say a vertical box
However, the actual widgets shown within the enclosing sizer is dynamic, depending on the particular choice of say, a radiobutton or combo box (with predefined values).
An example will illustrate this.
Say we want to display some widgets defining an item of type VEHICLES. We consider that there are only two sub-types of vehicles, cars and bikes.
If the user chooses “car” from a combo or radiobox, then the following widgets would be:
- engine capacity
- color
- date of manufacture
If the user had chosen “bike”, the following widgets would be:
- tire size
- color
- date of manufacture
This idea is extended every time a combo/check/radio type widget is encountered.
If I needed to do this only once, ie for VEHICLES (cars and bikes), I could easily hard code. However, this idea must be repeated many times for different sorts of items, not just vehicles.
Each time a radio/combo/check is encountered, the user choice MAY influence which entry widgets follow.
So I am looking for a pythonic, generic way of doing this, starting from some sort of (simple) data structure that would embody the rules.
Any ideas welcome.
(Thanks to all who make python and wxpython such great tools)
David
Right, so you traverse the tree from that point on, hiding or destroying the controls below, and then create/show the widgets for the new selection.
···
On Nov 10, 2014, at 8:03 PM, David Wende david.wende@gmail.com wrote:
I think that in initially generating and displaying the widgets I can easily follow such simple structures as you mentioned.
The part where I get lost is:
Once the widgets are displayed (using a default type such as “car”), I must react dynamically such that if the user then
changes his choice to bikes, the displayed widgets update automatically. There may be more than a single “choice” widget
in a complete tree, and this “choice” widget may affect one or more downstream widgets.
–
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
I agree with Tim. You just Hide/Destroy the widgets and Show/Create the new ones. I have an old tutorial that might help you a little:
···
On Monday, November 10, 2014 10:03:50 PM UTC-6, David Wende wrote:
Thanks Mike and Tim for your ideas.
I think that in initially generating and displaying the widgets I can easily follow such simple structures as you mentioned.
The part where I get lost is:
Once the widgets are displayed (using a default type such as “car”), I must react dynamically such that if the user then
changes his choice to bikes, the displayed widgets update automatically. There may be more than a single “choice” widget
in a complete tree, and this “choice” widget may affect one or more downstream widgets.
As I said, I could pretty easily hard-code this for “vehicles”, but the idea must be generic in that it should be applicable to
such things as “plants” etc based on my input data structure.
Thanks again.
Thanks to all who helped - I think I have it.
The idea of creating all needed widgets at first and then hide/show seems to be the way for me to go.
David
···
On Monday, November 10, 2014 10:14:15 AM UTC+2, David Wende wrote:
Hi
I need to generate a set of simple data entry widgets (such as textctrl or radiobox or checkbutton) that will reflect the properties of an item, and then stack the widgets within say a vertical box
However, the actual widgets shown within the enclosing sizer is dynamic, depending on the particular choice of say, a radiobutton or combo box (with predefined values).
An example will illustrate this.
Say we want to display some widgets defining an item of type VEHICLES. We consider that there are only two sub-types of vehicles, cars and bikes.
If the user chooses “car” from a combo or radiobox, then the following widgets would be:
- engine capacity
- color
- date of manufacture
If the user had chosen “bike”, the following widgets would be:
- tire size
- color
- date of manufacture
This idea is extended every time a combo/check/radio type widget is encountered.
If I needed to do this only once, ie for VEHICLES (cars and bikes), I could easily hard code. However, this idea must be repeated many times for different sorts of items, not just vehicles.
Each time a radio/combo/check is encountered, the user choice MAY influence which entry widgets follow.
So I am looking for a pythonic, generic way of doing this, starting from some sort of (simple) data structure that would embody the rules.
Any ideas welcome.
(Thanks to all who make python and wxpython such great tools)
David
OK - I have an almost working example.
I have tried for days to fix the following problems but to no avail.
Any ideas anyone?
The file is attached.
I am running on Windows 7, python2.7, wxpython 3.0.1.0
- Splitter sash is not visible
- RadioBox is not fitting into its sizer correctly
- My Show/Hide seems to work, but the enclosing sizers are not updating automatically as planned.
- In general I have a feeling that I am not utilizing the sizers correctly.
ps. As an aid to understanding the example, I am creating a horizontally splitter window, although the above problems relate only the top half.
For each item in the “capfields” dictionary I create a box sizer containing a label and either a entry or radiobox widget.
These sizes are stacked vertically in a vertical box sizer.
The radio buttons can either show or hide other size horizontal sizers depending on the initial data in the “capfields” dictionary.
David
itemsView.py (8.42 KB)
···
On Tuesday, November 18, 2014 7:56:23 PM UTC+2, David Wende wrote:
Thanks to all who helped - I think I have it.
The idea of creating all needed widgets at first and then hide/show seems to be the way for me to go.
David
On Monday, November 10, 2014 10:14:15 AM UTC+2, David Wende wrote:
Hi
I need to generate a set of simple data entry widgets (such as textctrl or radiobox or checkbutton) that will reflect the properties of an item, and then stack the widgets within say a vertical box
However, the actual widgets shown within the enclosing sizer is dynamic, depending on the particular choice of say, a radiobutton or combo box (with predefined values).
An example will illustrate this.
Say we want to display some widgets defining an item of type VEHICLES. We consider that there are only two sub-types of vehicles, cars and bikes.
If the user chooses “car” from a combo or radiobox, then the following widgets would be:
- engine capacity
- color
- date of manufacture
If the user had chosen “bike”, the following widgets would be:
- tire size
- color
- date of manufacture
This idea is extended every time a combo/check/radio type widget is encountered.
If I needed to do this only once, ie for VEHICLES (cars and bikes), I could easily hard code. However, this idea must be repeated many times for different sorts of items, not just vehicles.
Each time a radio/combo/check is encountered, the user choice MAY influence which entry widgets follow.
So I am looking for a pythonic, generic way of doing this, starting from some sort of (simple) data structure that would embody the rules.
Any ideas welcome.
(Thanks to all who make python and wxpython such great tools)
David
I had a typo in the attached file from previous post.
Reattached corrected file.
David
itemsView.py (8.53 KB)
···
On Wednesday, December 3, 2014 4:27:26 PM UTC+2, David Wende wrote:
OK - I have an almost working example.
I have tried for days to fix the following problems but to no avail.
Any ideas anyone?
The file is attached.
I am running on Windows 7, python2.7, wxpython 3.0.1.0
- Splitter sash is not visible
- RadioBox is not fitting into its sizer correctly
- My Show/Hide seems to work, but the enclosing sizers are not updating automatically as planned.
- In general I have a feeling that I am not utilizing the sizers correctly.
ps. As an aid to understanding the example, I am creating a horizontally splitter window, although the above problems relate only the top half.
For each item in the “capfields” dictionary I create a box sizer containing a label and either a entry or radiobox widget.
These sizes are stacked vertically in a vertical box sizer.
The radio buttons can either show or hide other size horizontal sizers depending on the initial data in the “capfields” dictionary.
David
On Tuesday, November 18, 2014 7:56:23 PM UTC+2, David Wende wrote:
Thanks to all who helped - I think I have it.
The idea of creating all needed widgets at first and then hide/show seems to be the way for me to go.
David
On Monday, November 10, 2014 10:14:15 AM UTC+2, David Wende wrote:
Hi
I need to generate a set of simple data entry widgets (such as textctrl or radiobox or checkbutton) that will reflect the properties of an item, and then stack the widgets within say a vertical box
However, the actual widgets shown within the enclosing sizer is dynamic, depending on the particular choice of say, a radiobutton or combo box (with predefined values).
An example will illustrate this.
Say we want to display some widgets defining an item of type VEHICLES. We consider that there are only two sub-types of vehicles, cars and bikes.
If the user chooses “car” from a combo or radiobox, then the following widgets would be:
- engine capacity
- color
- date of manufacture
If the user had chosen “bike”, the following widgets would be:
- tire size
- color
- date of manufacture
This idea is extended every time a combo/check/radio type widget is encountered.
If I needed to do this only once, ie for VEHICLES (cars and bikes), I could easily hard code. However, this idea must be repeated many times for different sorts of items, not just vehicles.
Each time a radio/combo/check is encountered, the user choice MAY influence which entry widgets follow.
So I am looking for a pythonic, generic way of doing this, starting from some sort of (simple) data structure that would embody the rules.
Any ideas welcome.
(Thanks to all who make python and wxpython such great tools)
David
OK - I have an almost working example.
I have tried for days to fix the following problems but to no avail.
Any ideas anyone?
The file is attached.
I am running on Windows 7, python2.7, wxpython 3.0.1.0
- Splitter sash is not visible
Same for me on Win7 and XP… if you want something there you will need to draw it (like a staticline along the edge of one of the panels)… or give your split panels a wx.BORDER_SUNKEN style.
- RadioBox is not fitting into its sizer correctly
You were specifying -1 which doesn’t seem valid (0 and 3 both work)
rb=wx.RadioBox(self,-1,“”,wx.DefaultPosition, wx.DefaultSize,item.toHide.keys(),majorDimension=0, style=wx.RA_SPECIFY_COLS | wx.NO_BORDER,name=item.name)
- My Show/Hide seems to work, but the enclosing sizers are not updating automatically as planned.
seems fine when I change the last two lines of onClickRB to:
self.Layout()
self.Fit()
- In general I have a feeling that I am not utilizing the sizers correctly.
Seems OK… you have some code duplication you could reduce, but it’s pretty minor (in onClickRB). You could also use the widget variable you’ve got there for
if status:
self.vbox_inner.Hide(widget)
···
On Wednesday, December 3, 2014 6:27:26 AM UTC-8, David Wende wrote:
Thanks Nathan for your helpful comments.
You are obviously correct regarding the -1. I changed this to 0 and the COLS to ROWS - much better.
I am still not getting a scroll-bar on the right side of the top splitter window as I expected (since it is a subclass of “scrolled.ScrolledPanel”
Putting self.Layout() and self.Fit() at end of onClickRB seems to make things worse for me!
David
···
On Wednesday, December 3, 2014 9:46:39 PM UTC+2, Nathan McCorkle wrote:
On Wednesday, December 3, 2014 6:27:26 AM UTC-8, David Wende wrote:
OK - I have an almost working example.
I have tried for days to fix the following problems but to no avail.
Any ideas anyone?
The file is attached.
I am running on Windows 7, python2.7, wxpython 3.0.1.0
- Splitter sash is not visible
Same for me on Win7 and XP… if you want something there you will need to draw it (like a staticline along the edge of one of the panels)… or give your split panels a wx.BORDER_SUNKEN style.
- RadioBox is not fitting into its sizer correctly
You were specifying -1 which doesn’t seem valid (0 and 3 both work)
rb=wx.RadioBox(self,-1,“”,wx.DefaultPosition, wx.DefaultSize,item.toHide.keys(),majorDimension=0, style=wx.RA_SPECIFY_COLS | wx.NO_BORDER,name=item.name)
- My Show/Hide seems to work, but the enclosing sizers are not updating automatically as planned.
seems fine when I change the last two lines of onClickRB to:
self.Layout()
self.Fit()
- In general I have a feeling that I am not utilizing the sizers correctly.
Seems OK… you have some code duplication you could reduce, but it’s pretty minor (in onClickRB). You could also use the widget variable you’ve got there for
if status:
self.vbox_inner.Hide(widget)
It looked pretty decent to me. One thing though, I didn’t change COLS to ROWS, as you are dealing with columns in the RadioBox (you wanted the RadioButtons horizontal, right?). Maybe that is why it looks funky?
Also I saw that your call to SetupScrolling is commented-out… you need that to start up the scroll-ability.
I just looked again and made some changes… looks good to me here.
itemsView.py (8.85 KB)
···
On Thursday, December 4, 2014 5:49:34 AM UTC-8, David Wende wrote:
Thanks Nathan for your helpful comments.
You are obviously correct regarding the -1. I changed this to 0 and the COLS to ROWS - much better.
I am still not getting a scroll-bar on the right side of the top splitter window as I expected (since it is a subclass of “scrolled.ScrolledPanel”
Putting self.Layout() and self.Fit() at end of onClickRB seems to make things worse for me!
I noticed that you are creating a StaticText as a label for the RadioBox widgets. Why not use the label argument when creating the RadioBox?
Essentially in your AddRadio function, I recommend removing the StaticText, and in the RadioBox creation change self,-1,“” to self,-1,item.name.
I’ve attached a modified version of your code as an example. I simply made the StaticText empty and moved the label to the RadioBox. When I have a chance I will attempt to make proper adjustments and repost the code.
itemsView_mod.py (8.86 KB)
···
On Monday, November 10, 2014 3:14:15 AM UTC-5, David Wende wrote:
Hi
I need to generate a set of simple data entry widgets (such as textctrl or radiobox or checkbutton) that will reflect the properties of an item, and then stack the widgets within say a vertical box
However, the actual widgets shown within the enclosing sizer is dynamic, depending on the particular choice of say, a radiobutton or combo box (with predefined values).
An example will illustrate this.
Say we want to display some widgets defining an item of type VEHICLES. We consider that there are only two sub-types of vehicles, cars and bikes.
If the user chooses “car” from a combo or radiobox, then the following widgets would be:
- engine capacity
- color
- date of manufacture
If the user had chosen “bike”, the following widgets would be:
- tire size
- color
- date of manufacture
This idea is extended every time a combo/check/radio type widget is encountered.
If I needed to do this only once, ie for VEHICLES (cars and bikes), I could easily hard code. However, this idea must be repeated many times for different sorts of items, not just vehicles.
Each time a radio/combo/check is encountered, the user choice MAY influence which entry widgets follow.
So I am looking for a pythonic, generic way of doing this, starting from some sort of (simple) data structure that would embody the rules.
Any ideas welcome.
(Thanks to all who make python and wxpython such great tools)
David
Hi Mike & Nathan
I really appreciate your comments and help.
- Fixed ROWS/COLS
- I want to keep StaticText besides the RB and not put label in RB since otherwise the Label will be not lined up nicely with those of Entries (and later on - ComboBox etc)
- I added sizer to bottom panel as suggested in your fixed example - much better!
- Re-added the setup for scrolling, and scroll bars now work. However this causes a problem:
- After clicking a RB the contents of the upper panel disappear until I move the sash of the splitted window. It seems that line 71 of properties.py is causing this, but I need this line.
- I also started to reorganize and split into two files (better for growing the project later on)
Thanks again
main.py (5.41 KB)
properties.py (2.69 KB)
···
On Thursday, December 4, 2014 9:04:37 PM UTC+2, Mike Stover wrote:
I noticed that you are creating a StaticText as a label for the RadioBox widgets. Why not use the label argument when creating the RadioBox?
Essentially in your AddRadio function, I recommend removing the StaticText, and in the RadioBox creation change self,-1,“” to self,-1,item.name.
I’ve attached a modified version of your code as an example. I simply made the StaticText empty and moved the label to the RadioBox. When I have a chance I will attempt to make proper adjustments and repost the code.
On Monday, November 10, 2014 3:14:15 AM UTC-5, David Wende wrote:
Hi
I need to generate a set of simple data entry widgets (such as textctrl or radiobox or checkbutton) that will reflect the properties of an item, and then stack the widgets within say a vertical box
However, the actual widgets shown within the enclosing sizer is dynamic, depending on the particular choice of say, a radiobutton or combo box (with predefined values).
An example will illustrate this.
Say we want to display some widgets defining an item of type VEHICLES. We consider that there are only two sub-types of vehicles, cars and bikes.
If the user chooses “car” from a combo or radiobox, then the following widgets would be:
- engine capacity
- color
- date of manufacture
If the user had chosen “bike”, the following widgets would be:
- tire size
- color
- date of manufacture
This idea is extended every time a combo/check/radio type widget is encountered.
If I needed to do this only once, ie for VEHICLES (cars and bikes), I could easily hard code. However, this idea must be repeated many times for different sorts of items, not just vehicles.
Each time a radio/combo/check is encountered, the user choice MAY influence which entry widgets follow.
So I am looking for a pythonic, generic way of doing this, starting from some sort of (simple) data structure that would embody the rules.
Any ideas welcome.
(Thanks to all who make python and wxpython such great tools)
David
Solved (sort of).
I found that if I replaced the RadioBox with a set of RadioButtons then all the layout / fit / disappearing widgets problems with solved.
Of course I have no explanation of WHY?
For the time being I will remain with RadioButtons even though more of my own coding will be necessary.
Thanks for the help.
David
···
On Saturday, December 6, 2014 7:47:46 PM UTC+2, David Wende wrote:
Hi Mike & Nathan
I really appreciate your comments and help.
- Fixed ROWS/COLS
- I want to keep StaticText besides the RB and not put label in RB since otherwise the Label will be not lined up nicely with those of Entries (and later on - ComboBox etc)
- I added sizer to bottom panel as suggested in your fixed example - much better!
- Re-added the setup for scrolling, and scroll bars now work. However this causes a problem:
- After clicking a RB the contents of the upper panel disappear until I move the sash of the splitted window. It seems that line 71 of properties.py is causing this, but I need this line.
- I also started to reorganize and split into two files (better for growing the project later on)
Thanks again
On Thursday, December 4, 2014 9:04:37 PM UTC+2, Mike Stover wrote:
I noticed that you are creating a StaticText as a label for the RadioBox widgets. Why not use the label argument when creating the RadioBox?
Essentially in your AddRadio function, I recommend removing the StaticText, and in the RadioBox creation change self,-1,“” to self,-1,item.name.
I’ve attached a modified version of your code as an example. I simply made the StaticText empty and moved the label to the RadioBox. When I have a chance I will attempt to make proper adjustments and repost the code.
On Monday, November 10, 2014 3:14:15 AM UTC-5, David Wende wrote:
Hi
I need to generate a set of simple data entry widgets (such as textctrl or radiobox or checkbutton) that will reflect the properties of an item, and then stack the widgets within say a vertical box
However, the actual widgets shown within the enclosing sizer is dynamic, depending on the particular choice of say, a radiobutton or combo box (with predefined values).
An example will illustrate this.
Say we want to display some widgets defining an item of type VEHICLES. We consider that there are only two sub-types of vehicles, cars and bikes.
If the user chooses “car” from a combo or radiobox, then the following widgets would be:
- engine capacity
- color
- date of manufacture
If the user had chosen “bike”, the following widgets would be:
- tire size
- color
- date of manufacture
This idea is extended every time a combo/check/radio type widget is encountered.
If I needed to do this only once, ie for VEHICLES (cars and bikes), I could easily hard code. However, this idea must be repeated many times for different sorts of items, not just vehicles.
Each time a radio/combo/check is encountered, the user choice MAY influence which entry widgets follow.
So I am looking for a pythonic, generic way of doing this, starting from some sort of (simple) data structure that would embody the rules.
Any ideas welcome.
(Thanks to all who make python and wxpython such great tools)
David
I recommend checking the code I sent, I just noticed a few differences that may be causing the troubles.
For one, you call SetupScrolling before setting your sizer, this might not matter… but it would be better to make sure the sizer knows about ALL the widgets (and the scroll bars may be included in the pixel counting it does).
Another think I noticed, in the code I sent I commented out the StaticText size.
Also, in the latest code, I don’t see you using a sizer in MyList (check the code I sent).
I was not getting your problem #5 with the code I sent, not sure how to reproduce it.
With your recently posted code, I cannot even click on the Radio buttons and have them respond.
···
On Saturday, December 6, 2014 9:47:46 AM UTC-8, David Wende wrote:
Hi Mike & Nathan
I really appreciate your comments and help.
- Fixed ROWS/COLS
- I want to keep StaticText besides the RB and not put label in RB since otherwise the Label will be not lined up nicely with those of Entries (and later on - ComboBox etc)
- I added sizer to bottom panel as suggested in your fixed example - much better!
- Re-added the setup for scrolling, and scroll bars now work. However this causes a problem:
- After clicking a RB the contents of the upper panel disappear until I move the sash of the splitted window. It seems that line 71 of properties.py is causing this, but I need this line.
- I also started to reorganize and split into two files (better for growing the project later on)
Hi Nathan,
I fixed the things you mentioned but for the time being am staying with radiobuttons and not radiobox. The graphics side of things seems OK.
I am now trying to “programmatically” simulate clicks on the RB. This is the purpose of the three new (temporary) buttons on the top.
Things are working partially - the RB value changes but the event triggering does not work. I added this to “self.setRB”.
I need the change in value to trigger an event such that onClickRB will be called to HIDE/SHOW the appropriate parts.
As usual all ideas are welcome and appreciated.
David
properties.py (3.38 KB)
main2.py (6.43 KB)
···
On Monday, December 8, 2014 7:17:38 PM UTC+2, Nathan McCorkle wrote:
On Saturday, December 6, 2014 9:47:46 AM UTC-8, David Wende wrote:
Hi Mike & Nathan
I really appreciate your comments and help.
- Fixed ROWS/COLS
- I want to keep StaticText besides the RB and not put label in RB since otherwise the Label will be not lined up nicely with those of Entries (and later on - ComboBox etc)
- I added sizer to bottom panel as suggested in your fixed example - much better!
- Re-added the setup for scrolling, and scroll bars now work. However this causes a problem:
- After clicking a RB the contents of the upper panel disappear until I move the sash of the splitted window. It seems that line 71 of properties.py is causing this, but I need this line.
- I also started to reorganize and split into two files (better for growing the project later on)
I recommend checking the code I sent, I just noticed a few differences that may be causing the troubles.
For one, you call SetupScrolling before setting your sizer, this might not matter… but it would be better to make sure the sizer knows about ALL the widgets (and the scroll bars may be included in the pixel counting it does).
Another think I noticed, in the code I sent I commented out the StaticText size.
Also, in the latest code, I don’t see you using a sizer in MyList (check the code I sent).
I was not getting your problem #5 with the code I sent, not sure how to reproduce it.
With your recently posted code, I cannot even click on the Radio buttons and have them respond.
David Wende wrote:
I fixed the things you mentioned but for the time being am staying
with radiobuttons and not radiobox. The graphics side of things seems OK.
I am now trying to "programmatically" simulate clicks on the RB. This
is the purpose of the three new (temporary) buttons on the top.
Things are working partially - the RB value changes but the event
triggering does not work. I added this to "self.setRB".
I need the change in value to trigger an event such that onClickRB
will be called to HIDE/SHOW the appropriate parts.
The right way to do this is to have a separate function called, for
example "UpdateUI", then call that function both from onClickRB and from
wherever else you need to trigger the event.
In other words, separate the actions you need to take from the UI things
that trigger them. The invoke your actions from wherever you need to,
instead of trying to fake up UI things.
···
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
So clicking the RB yourself sounds like it changes the UI as you wish, but you want to programmatically ‘click’ the RB and have the same effect? You must have tried using SetValue on it? If so, this code may be what you are looking for (it uses PostEvent):
···
On Tuesday, December 9, 2014 9:01:34 AM UTC-8, David Wende wrote:
Hi Nathan,
I fixed the things you mentioned but for the time being am staying with radiobuttons and not radiobox. The graphics side of things seems OK.
I am now trying to “programmatically” simulate clicks on the RB. This is the purpose of the three new (temporary) buttons on the top.
Things are working partially - the RB value changes but the event triggering does not work. I added this to “self.setRB”.
I need the change in value to trigger an event such that onClickRB will be called to HIDE/SHOW the appropriate parts.
Thanks Nathan,
This works well - good idea.
David
···
On Tuesday, December 9, 2014 8:27:52 PM UTC+2, Nathan McCorkle wrote:
On Tuesday, December 9, 2014 9:01:34 AM UTC-8, David Wende wrote:
Hi Nathan,
I fixed the things you mentioned but for the time being am staying with radiobuttons and not radiobox. The graphics side of things seems OK.
I am now trying to “programmatically” simulate clicks on the RB. This is the purpose of the three new (temporary) buttons on the top.
Things are working partially - the RB value changes but the event triggering does not work. I added this to “self.setRB”.
I need the change in value to trigger an event such that onClickRB will be called to HIDE/SHOW the appropriate parts.
So clicking the RB yourself sounds like it changes the UI as you wish, but you want to programmatically ‘click’ the RB and have the same effect? You must have tried using SetValue on it? If so, this code may be what you are looking for (it uses PostEvent):
http://stackoverflow.com/a/23203785/253127