[Tutor] YATENJoe

Joseph Quigley cpu.crazy at gmail.com
Mon May 16 02:55:26 CEST 2005


YATENJoe (Yet Another Text Editor, Named Joe)

First off, If this isn't the right place to ask, tell me so. That way I 
won't make this mistake again :-)

I want to make a text editor. I know that there are hundreds out there, but 
practice makes perfect, and I need the practice. My problem is that I have 
no idea how to make one. I've tried a little already by defining line 
functions:

def line1():
         l1 = raw_input("")
def line2():
         l2 = raw_input("")
line1()
line2()

Of course, this only allows for 2 lines. What's the trick to an infinite 
number of lines?
Event driven programming is a must, obviously. How can I use 'Ctrl' + 'Q' 
to quit while still being able to type: "Press 'Ctrl' + 'Q' to quit 
YATENJoe"? I'm still a newbie to python (actually OOP programming in 
general!) so I can't have a lot of complicated stuff thrown in my face.
I'd like it to not be platform specific, but if it has to be OS bound to be 
simple, then that's fine.

I thought of a function that would define a function for me. Is this 
possible? If it is how would I do it? If it possible, here's my idea:

def makefunc():
     # This is where it defines a function. If line1 = "full" then
     # make a new line adding 1 integer do separate it from the first.
     def l1():
         l1 = raw_input("")
         line1 = "full"
     l1()

makefunc()

One other thing, is there a way to call a function that is inside a 
function? 'Cause makefunc().l1() doesn't work.
Thanks in advance,
         JQ
PS: FYI  I use Windows XP Pro and Linux
PPS. FYI 2: I'm still a newbie to Linux too :-)  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050515/db458ec7/attachment.html


More information about the Tutor mailing list