buttonswitch.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:pkinter 作者: DeflatedPickle 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号