Is this the right place for this Question? May someone please recommend a text editor like notepad++ for Mac. I trolled through the net and cant seem to find anything close or anything that's free. I have been using Notepad++ for a while but have recently made an enviornment change to OSX to understand and learn more about other platforms. -------------Problems Reply------------ If you want free, you can download XCode from Apple for free. It's quite a power IDE, so if you're only after a text editor, it may be too much. Sublime Text 3 / Anaconda Python IDE. Sublime Text 3 is one of the most powerful cross platform lightweight code editors till date. With the use of plugins Sublime Text 3 can be used as a full featured IDE - the Sublime Python IDE. You get elegance of sublime text and powers of Python at one place to create your own magic. Truecrypt for mac download. I use TextMate. There's a 30 day trial if you just want to check it out. It's not free but you get what you pay for. Try TextMate lol Jeff you beat me by 15 seconds Category: Views: 2 Time:2012-02-20. To make a text editor we need a window. Type in the file: import sys v=sys.python_version if '2.7' in v: from Tkinter import * elif '3.3' in v or '3.4' in v: from tkinter import * root=Tk('Text Editor') root.mainloop() Then if you are on a mac go Cmd+Shift - search and open 'terminal' - then type python /pathto/texteditor.py and hit enter. If you are on a windows, search and open Command prompt, type python /pathto/texteditor.py and hit enter. You should se a screen that looks like the picture above. ![]() You need to be able to save your text of course, so we will add a button to save. Under import Tkinter add import tkFileDialog and under import tkinter add import tkinter.tkFileDialog Under the last line you added write this: def saveas(): global text t = text.get('1.0', 'end-1c') savelocation=tkFileDialog.asksaveasfilename() file1=open(savelocation, 'w+') file1.write(t) file1.close() button=Button(root, text='Save', command=saveas) button.grid() Clicking on the button will save your file. The full code: import sys v=sys.version() if '2.7' in v: from Tkinter import * import tkFileDialog elif '3.3' in v or '3.4' in v: from tkinter import * import tkinter.tkFileDialog root=Tk('Text Editor') text=Text(root) text.grid() def saveas(): global text t = text.get('1.0', 'end-1c') savelocation=tkFileDialog.asksaveasfilename() file1=open(savelocation, 'w+') file1.write(t) file1.close() button=Button(root, text='Save', command=saveas) button.grid() root.mainloop(). Under the last line you added, add this: def FontHelvetica(): global text text.config(font='Helvetica') def FontCourier(): global text text.config(font='Courier') font=Menubutton(root, text='Font') font.grid() font.menu=Menu(font, tearoff=0) font['menu']=font.menu helvetica=IntVar() courier=IntVar() font.menu.add_checkbutton(label='Courier', variable=courier, command=FontCourier) font.menu.add_checkbutton(label='Helvetica', variable=helvetica, command=FontHelvetica) Congratulations! You have finished a very simple text editor. If you want more tutorials like this tell me what. Run the file to use it! This whole thing is broken for python 3. I will say, this is a great learning tool for an intro into this.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |