(self, sheetname=None, sheetdata=None)
return sheetname
Add a new sheet - handles all the table creation stuff
Add a new sheet - handles all the table creation stuff
Add a new sheet - handles all the table creation stuff
def add_Sheet(self, sheetname=None, sheetdata=None):
        """Add a new sheet - handles all the table creation stuff"""

        def checksheet_name(name):
            if name == '':
                messagebox.showwarning("Whoops", "Name should not be blank.")
                return 0
            if name in self.sheets:
                messagebox.showwarning("Name exists", "Sheet name already exists!")
                return 0
        names = [self.notebook.tab(i, "text") for i in self.notebook.tabs()]
        noshts = len(names)
        if sheetname == None:
            sheetname = simpledialog.askstring("New sheet name?", "Enter sheet name:",
                                                initialvalue='sheet'+str(noshts+1))
        checksheet_name(sheetname)
        page = Frame(self.notebook)
        self.notebook.add(page, text=sheetname)
        #Create the table and model if data present
        if sheetdata != None:
            model = TableModel(sheetdata)
            self.currenttable = MyTable(page, model)
        else:
            self.currenttable = MyTable(page)

        #Load preferences into table
        self.currenttable.loadPrefs(self.preferences)
        #This handles all the canvas and header in the frame passed to constructor
        self.currenttable.createTableFrame()
        #add the table to the sheet dict
        self.sheets[sheetname] = self.currenttable
        self.saved = 0
        return sheetname
def add_Sheet ( self , sheetname = None , sheetdata = None ) : def checksheet_name ( name ) : if name == '' : messagebox . showwarning ( "Whoops" , "Name should not be blank." ) return 0 if name in self . sheets : messagebox . showwarning ( "Name exists" , "Sheet name already exists!" ) return 0 names = [ self . notebook . tab ( i , "text" ) for i in self . notebook . tabs ( ) ] noshts = len ( names ) if sheetname == None : sheetname = simpledialog . askstring ( "New sheet name?" , "Enter sheet name:" , initialvalue = 'sheet' + str ( noshts + 1 ) ) checksheet_name ( sheetname ) page = Frame ( self . notebook ) self . notebook . add ( page , text = sheetname ) #Create the table and model if data present if sheetdata != None : model = TableModel ( sheetdata ) self . currenttable = MyTable ( page , model ) else : self . currenttable = MyTable ( page ) #Load preferences into table self . currenttable . loadPrefs ( self . preferences ) #This handles all the canvas and header in the frame passed to constructor self . currenttable . createTableFrame ( ) #add the table to the sheet dict self . sheets [ sheetname ] = self . currenttable self . saved = 0 return sheetname