code: def new_file(self, basedir):
          
          title = _("New file")
          filters = _("All files")+" (*)"
          def create_func(fname):
              """File creation callback"""
              if osp.splitext(fname)[1] in ('.py', '.pyw', '.ipy'):
                  create_script(fname)
              else:
                  with open(fname, 'wb') as f:
                      f.write(to_binary_string(''))
          fname = self.create_new_file(basedir, title, filters, create_func)
          if fname is not None:
              self.open([fname])
docs: New file