(self, newname=None)
return
Add a new column
Add a new column
Add a new column
def addColumn(self, newname=None):
        """Add a new column"""

        if newname == None:

            coltypes = self.getModel().getDefaultTypes()
            d = MultipleValDialog(title='New Column',
                                    initialvalues=(coltypes, ''),
                                    labels=('Column Type','Name'),
                                    types=('list','string'),
                                    parent=self.parentframe)
            if d.result == None:
                return
            else:
                coltype = d.results[0]
                newname = d.results[1]

        if newname != None:
            if newname in self.getModel().columnNames:
                messagebox.showwarning("Name exists",
                                         "Name already exists!",
                                         parent=self.parentframe)
            else:
                self.model.addColumn(newname)
                self.parentframe.configure(width=self.width)
                self.redrawTable()
        return
def addColumn ( self , newname = None ) : if newname == None : coltypes = self . getModel ( ) . getDefaultTypes ( ) d = MultipleValDialog ( title = 'New Column' , initialvalues = ( coltypes , '' ) , labels = ( 'Column Type' , 'Name' ) , types = ( 'list' , 'string' ) , parent = self . parentframe ) if d . result == None : return else : coltype = d . results [ 0 ] newname = d . results [ 1 ] if newname != None : if newname in self . getModel ( ) . columnNames : messagebox . showwarning ( "Name exists" , "Name already exists!" , parent = self . parentframe ) else : self . model . addColumn ( newname ) self . parentframe . configure ( width = self . width ) self . redrawTable ( ) return