def create_spinbox(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 box = Spinbox(self.board) box.place(relx=x, rely=y, relheight=height, relwidth=width, anchor="nw") self.board.delete("line") items = [item for item in box.keys() if len(item) > 2] box.bind("<Enter>", lambda event: self.get_widget_info(box)) box.bind("<Leave>", lambda event: self.focus_out()) box.bind("<Button-3>", lambda event: self.modify(box, items)) self.manager.switch(box, items)