Re: Re: Looking for an "on/off" toggle control
Rolf <[email protected]> Thu, 21 Jan 2021 20:41:15 +0100
| Newsgroups | gmane.comp.python.wxpython |
|---|---|
| Message-ID | <[email protected]> |
I found a use case ( str(xxx.GetValue()) where it fails logically where I expected "True" or "False", that may just be my code. So change the GetValue function in onoffbutton.py to: def GetValue(self): if self._Value: return True else: return False As always, Beware there be dragons! Regards, Rolf On 21/01/2021 20:18, john fabiani wrote: > Thank you so much. I have downloaded it and will use it in the future > for sure! > > Johnf > > On 1/21/21 8:13 AM, Rolf wrote: >> Whilst I agreed with Johnf, I decided that I liked the idea of an on/off >> button, so while this is not of industrial strength, it serves the >> purpose for my requirements. >> >> You may want to alter the code to fit yours. >> >> I enclose the code, the demo image and an image of the control in one of >> my projects. >> >> Use at your own discretion. >> >> Usage: >> >> 'python onoffbutton.py' >> >> and >> >> 'import onoffbutton as oob' then 'self.fc_logging = >> oob.OnOffButton(self.tab7, wx.ID_ANY)' as a drop-in replacement for >> CheckBox >> >> Regards >> >> Rolf >> >> demo project >> On 14/01/2021 07:39, Matthias Brennwald wrote: >>> Wouldn't bitmapped buttons ask for trouble with todays variety of >>> screen resolutions? >>> >>> On Do, Jan 14, 2021 at 04:43, Steve Barnes <[email protected]> >>> wrote: >>>> Of course the agw SBitmapToggleButton could be used to provide a >>>> non-native switch effect. It would still be a button rather than a >>>> switch but with the appropriate bitmaps could give the appearance of >>>> just about any switch. >>>> >>>> >>>> *From:*[email protected] >>>> <[email protected]> *On Behalf Of *john fabiani >>>> *Sent:* 13 January 2021 22:18 >>>> *To:* [email protected] >>>> *Subject:* Re: [wxPython-users] Re: Looking for an "on/off" toggle >>>> control >>>> >>>> >>>> I agree with your links. That said - all we had was a checkbox or >>>> the toggle switch and some how we made due. >>>> >>>> Johnf >>>> >>>> On 1/13/21 12:45 PM, Matt Newville wrote: >>>> >>>> >>>> >>>> On Wed, Jan 13, 2021 at 2:01 PM john fabiani >>>> <[email protected] <mailto:[email protected]>> wrote: >>>> >>>> I normally don't use anything from windows 10 uwp - but I am >>>> fairly sure >>>> the Toggle switch is available. >>>> >>>> Also "re-inventing" - if you are not willing to write a >>>> custom widget >>>> then you will either have to wait until some future version >>>> that has the >>>> control built-in or make do with the checkbox. You must be >>>> aware that >>>> for many many years the checkbox was all that was available >>>> on all >>>> platforms. It seem to work just fine. The switch is a >>>> new UI >>>> development as are many others. I happen to like it - but >>>> many others I >>>> don't believe add anything other than change for changes >>>> sake. That >>>> said, I believe the current toggle switch conveys the action >>>> of being >>>> "on or off" very well. >>>> >>>> >>>> References: >>>> >>>> >>>> https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/toggles >>>> >>>> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fuwp%2Fdesign%2Fcontrols-and-patterns%2Ftoggles&data=04%7C01%7C%7Ca2a95f59c0cb4a03ee8608d8b81119cb%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637461730867743993%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=tpJyuSTDHH9cXv61MujvETweguvJba740XGFmw%2BhWpE%3D&reserved=0> >>>> >>>> >>>> https://developer.apple.com/design/human-interface-guidelines/macos/buttons/switches/ >>>> >>>> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper.apple.com%2Fdesign%2Fhuman-interface-guidelines%2Fmacos%2Fbuttons%2Fswitches%2F&data=04%7C01%7C%7Ca2a95f59c0cb4a03ee8608d8b81119cb%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637461730867773977%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=tu8c3inyJ9zsPEfg%2BQdZII0Wjjj7Fp1YYTBNEeAr2f0%3D&reserved=0> >>>> >>>> >>>> Both companies suggest that toggle switches have a different >>>> purpose from a checkbox, implying both immediate action (as >>>> opposed to the selection of a preference) and propagation to >>>> other GUI elements, turning on/off a whole category of options >>>> and displays for example. >>>> >>>> >>>> --Matt >>>> >>>> >>>> -- >>>> 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 [email protected] >>>> <mailto:[email protected]>. >>>> To view this discussion on the web visit >>>> >>>> https://groups.google.com/d/msgid/wxpython-users/CA%2B7ESbqwVdq%3DyXbNypgGNHCWnuM4Qe_0T1i7Tuk3yNjnQspzbg%40mail.gmail.com >>>> >>>> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fwxpython-users%2FCA%252B7ESbqwVdq%253DyXbNypgGNHCWnuM4Qe_0T1i7Tuk3yNjnQspzbg%2540mail.gmail.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=04%7C01%7C%7Ca2a95f59c0cb4a03ee8608d8b81119cb%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637461730867783972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=QkXnY58ZGooOPnVaWxbKZgLbpJLAOsxBVEMxEyaT6J0%3D&reserved=0>. >>>> >>>> -- >>>> 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 [email protected] >>>> <mailto:[email protected]>. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/wxpython-users/48ec4c47-d518-9975-3391-5f6e5f2d29cc%40gmail.com >>>> >>>> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fwxpython-users%2F48ec4c47-d518-9975-3391-5f6e5f2d29cc%2540gmail.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=04%7C01%7C%7Ca2a95f59c0cb4a03ee8608d8b81119cb%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637461730867793966%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=vCIvhd%2B24K2P4h4R3Dd%2Fp9NhPp7Mf1NXrFkzEZISRoo%3D&reserved=0>. >>>> >>>> >>>> -- >>>> 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 [email protected] >>>> <mailto:[email protected]>. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/wxpython-users/VI1PR03MB44790BABF461FD2FEF12BE8D9BA80%40VI1PR03MB4479.eurprd03.prod.outlook.com >>>> >>>> <https://groups.google.com/d/msgid/wxpython-users/VI1PR03MB44790BABF461FD2FEF12BE8D9BA80%40VI1PR03MB4479.eurprd03.prod.outlook.com?utm_medium=email&utm_source=footer>. >>>> >>> -- >>> 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 [email protected] >>> <mailto:[email protected]>. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/wxpython-users/0UVWMQ.7I5FXIYNQBZJ1%40gmail.com >>> >>> <https://groups.google.com/d/msgid/wxpython-users/0UVWMQ.7I5FXIYNQBZJ1%40gmail.com?utm_medium=email&utm_source=footer>. >>> > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/wxpython-users/ac2e7eb8-12a5-3acb-e973-6f21d7660a0d%40gmail.com. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/33f036a2-5fef-2283-5366-a366a6e2ad98%40gmail.com.