Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Textpad Document class
Index -> Programming, Python -> Python Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Insectoid




PostPosted: Tue Jun 10, 2008 5:54 pm   Post subject: Textpad Document class

Right, I feel like learning python as a summer project. I downloaded TextPad to type in my code with syntax coloration, as that helps me a lot. I have downloaded the python add-on from the site and have successfully created a document class with it. Now how do I use the class? Can I run the code directly form textpad or do I need to copy it into the interpreter? It's great to feel like a noob again! (not really)
Sponsor
Sponsor
Sponsor
sponsor
btiffin




PostPosted: Tue Jun 10, 2008 6:14 pm   Post subject: Re: Textpad Document class

Check this link for some instructions on how to launch python from within the editor.

http://www.atug.com/andypatterns/textpad_and_python.htm

There are probably other helper sites too; but the second screen is worth reading through. Note; I'd click the Save All Documents First checkbox as well; just in case something goes wrong in Python. Sucks losing an hour of typing when testing. And if you are like me, I'd uncheck the Sound Alert when Complete. Frickin' beeps from computers drive me apers.

Note; not being a textpad user (gVim all the way on Windows) I can't tell from that link what the hot key to launch the interpreter is. It'll be ctrl- something or Alt- something I'd guess (and it should show up in the Tools menu beside the launch option)

Cheers
Insectoid




PostPosted: Tue Jun 10, 2008 7:18 pm   Post subject: Re: Textpad Document class

Holy complicated. Why can't python just come with it's own syntax coloring?
btiffin




PostPosted: Tue Jun 10, 2008 7:34 pm   Post subject: RE:Textpad Document class

Umm, few interactive languages do; not a console coding priority. Mostly only the GUI shells like Squeak will be coloured.

If you want to run with the big dogs, learn emacs or vi. Smile

And I'll add emacs sucks, vi rulez. Usually the emacs/vi thing is a personal decision that is made early in a career and becomes somewhat religious after that, so choose wisely if you do follow my advice.

Emacs can lead to a career in Lisp so be careful, but, as it is based on Lisp, it is a highly programmable editor environment. Still sucks. It's for 4 armed 28 fingered freaks.

Use vim and get used to hitting escape. Smile

Cheers
Insectoid




PostPosted: Tue Jun 10, 2008 7:41 pm   Post subject: RE:Textpad Document class

Nah, I want to learn python because I've been told it's not too difficult and this site has a deicated forum for it!
btiffin




PostPosted: Tue Jun 10, 2008 8:55 pm   Post subject: Re: Textpad Document class

I was kidding (a little bit). vi and emacs are just editors though emacs fans may think otherwise, the whole it's a life style, dude! thing.

Both vi and emacs have syntax highlighters for Python (just about every editor does now-a-days). The comments about emacs and Lisp was regarding emacs' extensibility using Lisp macros. No need to learn Lisp to use emacs, but if you pick it as editor, you'll want to ... ergo the warning. It's like a spider to the fly thing. Choose vi if you are ever faced with the choice. Smile It doesn't hurt to know both, and it doesn't hurt using your GUI editor of choice either. One thing about coding any language, you want to be comfortable in your editor; get to the point of Zen while typing source so that it doesn't break the flow of creative programming.

Anyway, insectoid, I have faith you'll enjoy Python. Guido van Rossum is a smart guy and one of my heroes. But iirc, wtd opined that he may be a little my way or the highway when it comes to design decisions. The Benevolent Dictator For Life as they call him. One word of warning. Python release 3.0 (Python 3000) is scheduled for release in September and is slated to break compatibility with the 2.n releases. Read up a little, so that what you learn today isn't obsolete tomorrow. PEP 3000 and PEP 3100 have most of the details you'll need to keep in mind. That, and get used to counting tabs and watch out for editors and file transfers that muck with spacing. It can be a real pain. Indents are critical for Pythons control structures, not just for visual effect. Not a big deal as long as you are cognisant of the fact.

And I'll plug REBOL here too; I'm shameless.

Cheers
Insectoid




PostPosted: Wed Jun 11, 2008 7:34 am   Post subject: RE:Textpad Document class

Well, that makes sence now! I'll look into it tonight when I'm not at school!
shaon




PostPosted: Fri Jun 13, 2008 7:20 pm   Post subject: Re: Textpad Document class

why dont you just download python from the official website, www.python.org? It comes with a very simplistic IDE which is all you need to run a program.
Sponsor
Sponsor
Sponsor
sponsor
Aziz




PostPosted: Mon Jun 16, 2008 2:59 pm   Post subject: RE:Textpad Document class

Agreed with shaon, IDLE is it's name. It first starts the interactive prompt, but you can go to File > new or File > open. Pressing F5 IIRC in the file editor will run it in the other window (which then keeps an interactive session open - good to debug).

You can also just write it in any old editor (Notepadd++), save it as a .py and then run in command prompt "python sourcefile.py"
Insectoid




PostPosted: Thu Jun 19, 2008 5:48 pm   Post subject: RE:Textpad Document class

I downloaded geany (text editor). It is very simple to use, comes pre-loaded with python syntax, and is overall very nice. However, when I execute (after compiling) it gives me an error: 'python' is not an internal or external command, operable program or batch file'. I suppose the program is trying to execute in the wrong spot?
[Gandalf]




PostPosted: Thu Jun 19, 2008 6:08 pm   Post subject: Re: Textpad Document class

You have to add python to your environmental variables, google it.
Insectoid




PostPosted: Thu Jun 19, 2008 7:56 pm   Post subject: RE:Textpad Document class

I created it; still doesn't work. Note that python isn't in the program files folder. What did I do wrong?

variable: python
value: c:\Python25\python.exe
rizzix




PostPosted: Thu Jun 19, 2008 8:08 pm   Post subject: RE:Textpad Document class

No! Add "C:\Python25\" to your PATH.
Insectoid




PostPosted: Thu Jun 19, 2008 8:09 pm   Post subject: RE:Textpad Document class

Well, thank you; I feel stupid now. It's not my fault I've never done environment stuff before. Looks like I was close though...
Do I put the path in the 'value' section, or is there something I'm missing?
shaon




PostPosted: Thu Jun 19, 2008 8:41 pm   Post subject: Re: Textpad Document class

I still think the best way to go is IDLE, which COMES WITH PYTHON. It's extremely easy to use, and you can write code and run quickly and efficiently. IDLE is built for python, unlike Notepad ++ or other syntax writers.

My second suggestion once you get used to python, is to use SPE http://pythonide.blogspot.com/ . It is extremely useful for projects. It comes with a many other little programs that really help for making projects. For example if you forgot to close any brackets the syntax gets a nice red underline like the way MS Word underlines errors. It lets you fix up syntax errors, which other might otherwise be detected only at runtime. I haven't to worry about forgetting to close my 6th-nth bracket when writing long mathematical codes in a long time Very Happy .

It also comes with a feature, that shows all your classes (and their respective methods) and global functions neatly on the side, so that you can better manage your classes/functions.

SPE is not the best tool for learning or getting used to Python, but it is very good for projects.
Display posts from previous:   
   Index -> Programming, Python -> Python Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 18 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: