Re: Issue with Hiding Labels
"Brendan Simon (eTRIX)" <[email protected]>
| Newsgroups | gmane.comp.python.wxglade |
|---|---|
| Organization | eTRIX pty ltd |
| Message-ID | <[email protected]> |
On 3/4/19 8:33 am, William Luitje wrote: > I have a window in my application that can be popped up when the user > requests one of several actions. I have recently added some UI > elements that are only needed for one of the actions. I decided that > rather than create a new window for a new action I would just add the > UI elements to the base window and hide the UI elements that aren't > needed. > > What I am experiencing is that the comboboxes can be hidden but that > the labels describing the comboboxes can't be hidden and python throws > an exception when the code tries to do that. The issue, as I > understand it, is the labels are only defined and used in the > __do_layout function of the window thus there is no way to modify the > label's appearance outside of that function. In some of the other > windows I can see that labels are generated as properties of the > window class but I haven't been able to discern how to mandate that > behavior. > > As a workaround I have edited the label names to have a "self." prefix > which allows those elements to be accessed outside the function. Of > course I need to redo that manual edit whenever I regen the UI with > wxGlade, which is getting tiresome already. > > Does anyone have any ideas about fixing this situation? I'm fairly sure there is a "set attribute" checkbox in on the of the tabs. When this is checked the name of the object becomes an attribute and you can access it as `self.my_label` or `my_window.my_label` depending on the where your code is calling it from. Brendan. _______________________________________________ wxGlade-general mailing list wxGlade-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/wxglade-general