Hah, that is a pretty cool guide. Thanks for that. I'll code something basic in Python and then in Ruby and see where my preference lies, they both have what I need.8086 wrote:Have a look at Ruby (and some cartoon foxes !?!?)

Which one is best suited is difficult to answer.Donman wrote:Or, I could jump into something far more extreme, like C or Java...Recommendations? I have nothing against the various languages, I just don't really know which one would be best suited for the task at hand.

I listed a little bit of what I was wanting to do a few posts up. 1-3 are the main things I want to get working. Get a simple working prototype going, then begin to actually implement everything. That way I can get my hands dirty and get the basics of what I need down.barophobia wrote: Which one is best suited is difficult to answer.
1) what are you doing?
2) how are you going to deploy it?
3) design requirements? memory limitations, real time app, licensing
4) is it just a prototype for an idea?
5) personal preference
You will have a much better idea of which language to use once you program more.
Code: Select all
#! /usr/bin/env python
############################################################################
# Copyright (C) 2008 by Donavan Lance #
# tusklahoma @ gmail . com #
# #
# This program is free software; you can redistribute it and#or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the #
# Free Software Foundation, Inc., #
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
############################################################################
## NOTE TO SELF: COMMENT THE CODE UP SOME!!
from Tkinter import *
from tkFileDialog import *
import os.path
import sys
class NegativeInfinity:
ftypes = [('Text', '*.txt'), ('HTML', ('*.htm', '*.html')), ('All Files', '*.*')]
startfiledir = os.path.expanduser('~/')
def __init__(self, master):
self.mainFrame = Frame(master)
self.mainFrame.pack(side = TOP, anchor = NW)
self.openButton = Button(self.mainFrame, text = 'Open', command = self.openButtonCommand)
self.openButton.pack(side = LEFT)
self.newButton = Button(self.mainFrame, text = 'New', command = self.newButtonCommand)
self.newButton.pack(side = LEFT)
self.saveButton = Button(self.mainFrame, text = 'Save', command = self.saveButtonCommand)
self.saveButton.pack(side = LEFT)
self.textFrame = Frame(master)
self.textFrame.pack(side = BOTTOM, fill = BOTH, expand = YES)
self.textEditor = Text(self.textFrame, wrap = WORD) # Ok, time to add comments. This needs to be customizable by the user,
self.textEditor.pack(fill = BOTH, expand = YES) # not arbitraily defined. (regarding "wrap = WORD"
self.textEditor.focus()
## Just threw this in here so one can supply a file from the command line. Indeed, it really shouldn't be right here, but whatever.
## I'll split it out when I split the other things out as well.
try:
if sys.argv[1]:
try:
self.file = open(sys.argv[1], 'U')
self.lines = self.file.read()
self.file.close()
except IOError:
self.lines = 'No such file! Feel free to delete me and start anew!'
self.textEditor.insert(0.0, self.lines)
except IndexError:
pass
## This is set up to automatically clear any text that is on screen when opening a new file. Perhaps there should be a warning? No no,
## this just needs to be redone.
def openButtonCommand(self):
self.openFile = askopenfile(mode = 'U', initialdir = self.startfiledir, filetypes = self.ftypes)
if self.openFile:
self.openFileText = self.openFile.read()
self.openFile.close()
self.textEditor.delete(0.0, END)
self.textEditor.insert(0.0, self.openFileText)
## Whoa. This one is much more iffy than the open one. Press "New", and bye-bye any text you have written. Be sure to save before
## hitting this button. Yes, a window should pop up to warn, and I'll get around to it if I find it appropriate.
def newButtonCommand(self):
self.textEditor.delete(0.0, END)
#self.newFile = None ## Commented out, to retain it just in case its needed again.
#self.newwindow = Toplevel()
#self.newwindowFrame = Frame(self.newwindow)
#self.newwindowFrame.pack()
#self.newwindowLabel = Label(self.newwindowFrame)
#self.newwindowLabel['text'] = 'Not Implemented!...yet!'
#self.newwindowLabel.pack()
## This works, but is hackish. Could be better somehow? Try/Except would help, something else though? Don't really know at the moment
## but do come back to this.
def saveButtonCommand(self):
self.saveFile = asksaveasfile(initialdir = self.startfiledir, filetypes = self.ftypes)
if self.saveFile:
text = self.textEditor.get(0.0, END)
self.saveFile.write(text)
self.saveFile.close()
root = Tk()
negativeInfinity = NegativeInfinity(root)
root.title('NegativeInfinity-0.0-prealpha-r0')
root.mainloop()
