Python Forum
[Tkinter] optimalization of code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] optimalization of code
#6
i try like this something short:
    def confirm(self):
        s[:] = [1 if v.get() else 0 for v in self.checkvars]

        self.chk1.config(state=DISABLED if s[5] == 1 else NORMAL )
        self.chk2.config(state=DISABLED if s[6] == 1 else NORMAL)
        self.chk3.config(state=DISABLED if s[7] == 1 else NORMAL )
        self.chk4.config(state=DISABLED if s[8] == 1 else NORMAL)
        self.chk5.config(state=DISABLED if s[9] == 1 else NORMAL )
        self.chk11.config(state=DISABLED if s[0] == 1 else NORMAL)
        self.chk12.config(state=DISABLED if s[1] == 1 else NORMAL)
        self.chk13.config(state=DISABLED if s[2] == 1 else NORMAL)
        self.chk14.config(state=DISABLED if s[3] == 1 else NORMAL)
        self.chk15.config(state=DISABLED if s[4] == 1 else NORMAL)
any suggestion?
Reply


Messages In This Thread
optimalization of code - by storzo - Aug-06-2019, 10:07 PM
RE: optimalization of code - by Yoriz - Aug-07-2019, 05:18 AM
RE: optimalization of code - by storzo - Aug-07-2019, 05:35 AM
RE: optimalization of code - by Yoriz - Aug-07-2019, 05:42 AM
RE: optimalization of code - by storzo - Aug-07-2019, 05:50 AM
RE: optimalization of code - by storzo - Aug-07-2019, 07:15 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020