Oct-28-2016, 02:51 AM
Here is some code for my text editor (in progress)
For some strange reason, if I press '<', i get the error
bksp() takes no arguments (1 given)
What gives?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
print 'WELCOME TO CHARPY V2' import os #os detection/import msvcrt try : import msvcrt except ImportError: print 'ERROR: FAILED TO IMPORT MSVCRT. ARE YOU USING MAC OS X OR UNIX/LINUX?' print 'IF SO, PLEASE USE WINDOWS FOR CHARPY V2' quit() #defining class for documents class doc( object ): def __init__( self ): #this is the actual text self .text = list () self .name = raw_input ( 'NAME YOUR NEW DOCUMENT' ) def bksp(): length = len ( self .text) length = length - 1 lob = self .text[length] self .text.remove[lob] def edit( self ): self .isedit = True while self .isedit: char = msvcrt.getch() if char not in ( '<' , '`' ): self .text.append(char) elif char = = '<' : self .bksp() elif char = = '`' : #stop editing self .isedit = False os.system( 'CLS' ) print self .text x = doc() x.edit() |
bksp() takes no arguments (1 given)

What gives?