(self, event)
return popupmenu
Add left and right click behaviour for column header
Add left and right click behaviour for column header
Add left and right click behaviour for column header
def popupMenu(self, event):
        """Add left and right click behaviour for column header"""

        colname = self.model.columnNames[self.table.currentcol]
        collabel = self.model.columnlabels[colname]
        currcol = self.table.currentcol
        popupmenu = Menu(self, tearoff = 0)
        def popupFocusOut(event):
            popupmenu.unpost()
        popupmenu.add_command(label="Rename Column", command=self.relabel_Column)
        popupmenu.add_command(label="Sort by "+ collabel, command=lambda : self.table.sortTable(currcol))
        popupmenu.add_command(label="Sort by "+ collabel +' (descending)', command=lambda : self.table.sortTable(currcol,reverse=1))
        popupmenu.add_command(label="Delete This Column", command=self.table.deleteColumn)
        popupmenu.add_command(label="Add New Column", command=self.table.addColumn)

        popupmenu.bind("<FocusOut>", popupFocusOut)
        #self.bind("<Button-3>", popupFocusOut)
        popupmenu.focus_set()
        popupmenu.post(event.x_root, event.y_root)
        return popupmenu
def popupMenu ( self , event ) : colname = self . model . columnNames [ self . table . currentcol ] collabel = self . model . columnlabels [ colname ] currcol = self . table . currentcol popupmenu = Menu ( self , tearoff = 0 ) def popupFocusOut ( event ) : popupmenu . unpost ( ) popupmenu . add_command ( label = "Rename Column" , command = self . relabel_Column ) popupmenu . add_command ( label = "Sort by " + collabel , command = lambda : self . table . sortTable ( currcol ) ) popupmenu . add_command ( label = "Sort by " + collabel + ' (descending)' , command = lambda : self . table . sortTable ( currcol , reverse = 1 ) ) popupmenu . add_command ( label = "Delete This Column" , command = self . table . deleteColumn ) popupmenu . add_command ( label = "Add New Column" , command = self . table . addColumn ) popupmenu . bind ( "<FocusOut>" , popupFocusOut ) #self.bind("<Button-3>", popupFocusOut) popupmenu . focus_set ( ) popupmenu . post ( event . x_root , event . y_root ) return popupmenu