Beispiel #1
0
    def create_checkbutton(self):
        P0, widget_dims, board_dims = self.board.get_geometry()
        x, y = P0
        width, height = widget_dims
        board_width, board_height = board_dims

        x, y = x / board_width, y / board_height
        width, height = width / board_width, height / board_height

        button = Checkbutton(self.board)
        button.place(relx=x, rely=y, relheight=height, relwidth=width, anchor="nw")
        self.board.delete("line")
        items = [item for item in button.keys() if len(item) > 2]

        button.bind("<Enter>", lambda event: self.get_widget_info(button))
        button.bind("<Leave>", lambda event: self.focus_out())
        button.bind("<Button-3>", lambda event: self.modify(button, items))

        self.manager.switch(button, items)