Re: Conditional widget style
Dietmar Schwertberger <[email protected]> Thu, 3 Feb 2022 18:49:53 +0100
| Newsgroups | gmane.comp.python.wxglade |
|---|---|
| Message-ID | <[email protected]> |
On 03.02.2022 10:02, ChordPro Team wrote: > The best I have found so far is to call its SetEditable method to change > its editable status, but that doesn't change the difference in style between > a wxTE_READONLY widget and a normal one. > > Is there a decent and reliable way to accompish this? I think that this is one of the cases where a later call to 'SetStyle' will not work. You may either "simulate" a readonly text ctrl or replace it. Try code like this in "Code to inserted after": self.text_ctrl_1.DestroyLater() self.text_ctrl_1 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.RE_READONLY) wxGlade will then generate code like this: self.text_ctrl_1 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "") self.text_ctrl_1.DestroyLater() # Destroy() might be fine as well self.text_ctrl_1 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.RE_READONLY) sizer_1.Add(self.text_ctrl_1, 0, 0, 0) If you need to do the style change later, you can retrieve the sizeritem and replace the widget. Regards, Dietmar _______________________________________________ wxGlade-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wxglade-general