def __init__(self, parent, *args):
ttk.Frame.__init__(self, parent, *args)
self.parent = parent
self.columnconfigure((0, 1), weight=1)
self._button_variable = tk.BooleanVar()
self._button_variable.set(False)
self._label_variable = tk.BooleanVar()
self._label_variable.set(True)
self._label_text_variable = tk.StringVar()
ttk.Style().configure("Switch.TLabel", background="white", foreground="light gray", anchor="center")
ttk.Style().configure("Label.TLabel", background="light blue", foreground="white", anchor="center")
self._button = ttk.Label(self, text="| | |", width=4, style="Switch.TLabel")
self._button.bind("<Button-1>", self.switch, "+")
self._label = ttk.Label(self, textvariable=self._label_text_variable, width=4, style="Label.TLabel")
ttk.Style().configure("ButtonSwitch.TFrame", background="light blue")
self.configure(style="ButtonSwitch.TFrame")
self.switch()
评论列表
文章目录