[Tutor] re.Binding Events

2009-02-09 Thread prasad rao
HelloI tried various permutations of the code.Nothing worked. I am mixing 2 examples given in "an-introduction-to- tkinter " by Fredrik Lundh.(and got this code) Today I got this error message Traceback (most recent call last): File "", line 1, in pp() File "", line 18, in pp xx=app(r

Re: [Tutor] help with loop that is to be fed out of a word list

2009-02-09 Thread John Fouhy
2009/2/10 David : > Dear list, > > out of "Thinking in Python" I take the following code, which > "takes a word and a string of required letters, and that returns True if > the word uses all the required letters at least once". > > > def uses_all(word, required): >for letter in required: >

[Tutor] help with loop that is to be fed out of a word list

2009-02-09 Thread David
Dear list, out of "Thinking in Python" I take the following code, which "takes a word and a string of required letters, and that returns True if the word uses all the required letters at least once". def uses_all(word, required): for letter in required: if letter not in word:

Re: [Tutor] IDLE vs PythonWin

2009-02-09 Thread Eric Dorsey
You can call a .py script from the command line, and it will run there. So, in Windows XP: Start > Run > type "CMD" Vista: Start > type "CMD" into the Start Search field. If you're in Linux, get to a Terminal. In Windows another window will open with something like...C:\FolderWithMyPyFile> Linux so

Re: [Tutor] apply() after class?

2009-02-09 Thread Kent Johnson
On Mon, Feb 9, 2009 at 5:33 PM, Wayne Watson wrote: > Ah, another function without a link to a use. body, as in : > (note that apply really is part of the class. It looked outside it earlier.) > > class SetDecoderDialog(tkSimpleDialog.Dialog): > > def __init__(self, parent, gui): > sel

Re: [Tutor] Simple PassGen

2009-02-09 Thread Kent Johnson
On Mon, Feb 9, 2009 at 5:32 PM, Marc Tompkins wrote: > Don't forget - the "print" statement is going away in 3.0, and you really > should get into the habit of using the print() function instead for new > code. IIRC, print() does NOT support suppressing the newline, but IMNRC (I > might not remem

Re: [Tutor] Is this correct?

2009-02-09 Thread cclpianos
Hello again, just getting back to the computer, real world etc. I hate to say this, but I never did well in algebra. But I am determined to slog through this to understand it well. On Feb 8, 2009, at 7:29 PM, bob gailer wrote: Please always reply-all so a copy goes to the list. We all parti

Re: [Tutor] Is this correct?

2009-02-09 Thread cclpianos
Hi Bob, I missed this in my in box. Sorry. See below where I have answered your question with yet another. On Feb 8, 2009, at 11:10 AM, bob gailer wrote: cclpia...@comcast.net wrote: HI, I just realized that I shouldn't enclose my project in an attachment. This is my first attempt to string t

Re: [Tutor] apply() after class?

2009-02-09 Thread Wayne Watson
Title: Signature.html Ah, ha. Good old polymorphism (from my long gone C++ days). Back to the book, old Lutz.  I'll try the print.  Thanks. I'll check out  tkSimpleDialog's description in one of the several pdfs I have on Tk.  Alan Gauld wrote: "Wayne Watson" wrote Ah, another function w

Re: [Tutor] IDLE vs PythonWin

2009-02-09 Thread Wayne Watson
Title: Signature.html You must be up 24/7! When I open a py file with pythonwin, it brings up the dialog and in its window, there are two windows. One is called interactive window (IW), and the other (script window--SW) contains the program py code. To execute it, I press the little running ico

[Tutor] __builtins__

2009-02-09 Thread greg whittier
I'm trying to use sparkplot from sparkplot.org as a module. It's normally run from the command line and acts on an input file. I'd like to use it as a module though to render png's for a web application. Anyway, if I try "import sparkplot" from the interpreter, I get >>> import sparkplot Traceb

Re: [Tutor] Simple PassGen

2009-02-09 Thread Alan Gauld
"Marc Tompkins" wrote Don't forget - the "print" statement is going away in 3.0, and you really should get into the habit of using the print() function instead for new code. IIRC, print() does NOT support suppressing the newline, From the v3 Whats New document: Old: print x,

Re: [Tutor] apply() after class?

2009-02-09 Thread Alan Gauld
"Wayne Watson" wrote Ah, another function without a link to a use. body, as in : class SetDecoderDialog(tkSimpleDialog.Dialog): def body(self,master): self.title("Set Video Decoder Register") Label(master, text='Register:').grid(row=0, sticky=W) Label(master, text='N

Re: [Tutor] IDLE vs PythonWin

2009-02-09 Thread ALAN GAULD
> Yes, but how do you debug the code interactively when you have > the editor outside pythonwin? Do you copy it into the pythonwin editor? Do you mean using the Python debugger? If I need to do that I will either use the command line debugger (pdb) inside the shell window or close the vim sessio

Re: [Tutor] IDLE vs PythonWin

2009-02-09 Thread Wayne Watson
Yes, but how do you debug the code interactively when you have the editor outside pythonwin? Do you copy it into the pythonwin editor? ALAN GAULD wrote: No you aren't missing anything. You will only have vim if you choose to install it. It was just an example of a text editor. It could

Re: [Tutor] Simple PassGen

2009-02-09 Thread Sander Sweers
On Mon, Feb 9, 2009 at 23:32, Marc Tompkins wrote: > Don't forget - the "print" statement is going away in 3.0, and you really > should get into the habit of using the print() function instead for new > code. Why? Python's print statement is not going away in the 2.x series which will be supporte

Re: [Tutor] Picking up citations

2009-02-09 Thread Marc Tompkins
Aha! My list of "magic words"! (Sorry for the top post - anybody know how to change quoting defaults in Android Gmail?) --- www.fsrtechnologies.com On Feb 9, 2009 2:16 PM, "Dinesh B Vadhia" wrote: Kent /Emmanuel I found a list of words before the first word that can be removed which I think i

Re: [Tutor] apply() after class?

2009-02-09 Thread Wayne Watson
Title: Signature.html Ah, another function without a link to a use. body, as in : (note that apply really is part of the class. It looked outside it earlier.) class SetDecoderDialog(tkSimpleDialog.Dialog):     def __init__(self, parent, gui):     self.gui = gui     tkSimpleDialog.Dial

Re: [Tutor] Simple PassGen

2009-02-09 Thread Marc Tompkins
Don't forget - the "print" statement is going away in 3.0, and you really should get into the habit of using the print() function instead for new code. IIRC, print() does NOT support suppressing the newline, but IMNRC (I might not remember correctly.) --- www.fsrtechnologies.com On Feb 9, 2009

[Tutor] Picking up citations

2009-02-09 Thread Dinesh B Vadhia
Kent /Emmanuel I found a list of words before the first word that can be removed which I think is the only way to successfully parse the citations. Here they are: | E.g. | Accord | See |See + Also | Cf. | Compare | Contra | But + See | But + Cf. | See Generally | Citing | In | Dinesh

Re: [Tutor] Simple PassGen

2009-02-09 Thread spir
Le Mon, 9 Feb 2009 13:45:04 -0800, Marc Tompkins a écrit : > The print() function adds a newline. Try this instead - above your loop, > create an empty string; in place of yor print(), append to the string; at > the end, print the whole string. > > I'd demonstrate but I'm typing this from my ph

Re: [Tutor] Simple PassGen

2009-02-09 Thread Kayvan Sarikhani
On Mon, Feb 9, 2009 at 4:53 PM, W W wrote: > It's actually not the range but the print function. Print automatically > prints a newline. If you were to create a string of what print does: > > print 'foo' > > 'foo\n' > > However, adding a trailing comma will eliminate that. It will still add a > t

Re: [Tutor] Simple PassGen

2009-02-09 Thread Kayvan Sarikhani
Ah, I see what you mean...this does seem to work: #!/usr/bin/python import random, string pool = string.digits + string.letters + string.punctuation outstr = '' for i in range(8): outstr += random.choice(pool) print outstr Thanks very much! K On Mon, Feb 9, 2009 at 4:45 PM, Marc Tompkin

Re: [Tutor] Simple PassGen

2009-02-09 Thread W W
On Mon, Feb 9, 2009 at 3:35 PM, Kayvan Sarikhani wrote: > Hello Tutors, > I thought that maybe adding "print random.choice(pool).strip()" > might work but not having any luck with that. Is the output this way, simply > because of the nature of the range, or can anyone point my in the right > dir

Re: [Tutor] Simple PassGen

2009-02-09 Thread Marc Tompkins
The print() function adds a newline. Try this instead - above your loop, create an empty string; in place of yor print(), append to the string; at the end, print the whole string. I'd demonstrate but I'm typing this from my phone. --- www.fsrtechnologies.com On Feb 9, 2009 1:35 PM, "Kayvan Sar

[Tutor] Simple PassGen

2009-02-09 Thread Kayvan Sarikhani
Hello Tutors, I've been messing around with a simple password generation script...no real crypto or anything, but a little stumped on the output. #!/usr/bin/python import random, string pool = string.digits + string.letters + string.punctuation for i in range(8): print random.choice(pool)

Re: [Tutor] apply() after class?

2009-02-09 Thread Wayne Watson
Title: Signature.html Any idea what it would be used for? Kent Johnson wrote: On Mon, Feb 9, 2009 at 2:03 PM, Wayne Watson wrote: I see the following code that follows some of the class definitions in some python code I'm modifying. I don't see the function anywhere in the progra

Re: [Tutor] apply() after class?

2009-02-09 Thread Kent Johnson
On Mon, Feb 9, 2009 at 2:03 PM, Wayne Watson wrote: > I see the following code that follows some of the class definitions in some > python code I'm modifying. I don't see the function anywhere in the program. > Possibly it's called from another module, but I doubt it. There's only one > other non-

Re: [Tutor] Tkinter Expanding Canvas with AutoScrollBar

2009-02-09 Thread Alexander Grant
Well. I solved my own problem. Mainly I wasn't using the grid manager everywhere, and I think that's what was messing it up! Thanks anyways! Al On Mon, Feb 9, 2009 at 12:29 PM, Alexander Grant wrote: > Hi Tutors, > Thanks in advance for all the advice you've already given to others... it > has

[Tutor] Tkinter Expanding Canvas with AutoScrollBar

2009-02-09 Thread Alexander Grant
Hi Tutors, Thanks in advance for all the advice you've already given to others... it has been extremely useful! I'm working on a project, and I wanted to have a header, a footer and an expanding canvas with (possibly) many widgets inside it. I simply modified Fred Lundh's auto-hiding scrollbar c

[Tutor] Splitting strings and undefined variables

2009-02-09 Thread Moos Heintzen
Hello all, I was looking at this: http://www.debian.org/doc/manuals/reference/ch-program.en.html#s-python I have a question about the line of code that uses split() With the python version, the line below only works if there are three fields in line. (first, last, passwd) = line.split() Also,

Re: [Tutor] Reading binary files #2

2009-02-09 Thread eShopping
Hi Bob some replies below. One thing I noticed with the "full" file was that I ran into problems when the number of records was 10500, and the file read got misaligned. Presumably 10500 is still within the range of int? Best regards Alun At 17:49 09/02/2009, bob gailer wrote: etrade.gr

[Tutor] apply() after class?

2009-02-09 Thread Wayne Watson
Title: Signature.html I see the following code that follows some of the class definitions in some python code I'm modifying. I don't see the function anywhere in the program. Possibly it's called from another module, but I doubt it. There's only one other non-python library module for it. It ha

[Tutor] Python & MySQL... Define port.

2009-02-09 Thread Network Administrator
Hello everybody! I want to use Python to query a given MySQL database. However, this database is running on port 3308, instead the traditional 3306. I read that (example): MySQLdb.connect(host="dbserv', db='inv', user='smith') can be used to query a given database; however, it didn't work in m

Re: [Tutor] Picking up citations

2009-02-09 Thread Dinesh B Vadhia
Kent /Emmanuel Below are the results using the PLY parser and Regex versions on the attached 'sierra' data which I think covers the common formats. Here are some 'fully unparsed" citations that were missed by the programs: Smith v. Wisconsin Dept. of Agriculture, 23 F.3d 1134, 1141 (7th Cir.1

Re: [Tutor] Reading binary files #2

2009-02-09 Thread bob gailer
etrade.griffi...@dsl.pipex.com wrote: Hi following last week's discussion with Bob Gailer about reading unformatted FORTRAN files, I have attached an example of the file in ASCII format and the equivalent unformatted version. Thank you. It is good to have real data to work with. Below is so

Re: [Tutor] Exec(uting) Code in a Dictionary?

2009-02-09 Thread Wayne Watson
Title: Signature.html As something of a surprise here, and as I got further into the code I'm adding and modifying, the author did pretty much the dictionary approach I was contemplating. I think I'll stick with the flow. Wayne Watson wrote: That's something for me to ponder, setattr. I'd

Re: [Tutor] Binding Events

2009-02-09 Thread Alan Gauld
"prasad rao" wrote Hi I am unable to bind an event to a widget despite of my best efforts. So give us a clue. What happened? Do you get any error messages in the console when you run it? Does the GUI display but just not respond? Please don't make us guess... class app: def __init__(se

Re: [Tutor] Reading binary files #2

2009-02-09 Thread Alan Gauld
wrote I have attached an example of the file in ASCII format and the equivalent unformatted version. Comparing them in vim... It doesn't look too bad except for the DATABEGI / DATAEND message format. That could be tricky to unravel but we have no clear format for MESS. But I assume that all

[Tutor] Binding Events

2009-02-09 Thread prasad rao
Hi I am unable to bind an event to a widget despite of my best efforts. Some one please help me. class app: def __init__(self,root): frame=Frame(root) frame.bind('',self.callback) frame.pack() self.event=event self.button=Button(root,text='quit',fg='red',command=frame.quit) self.button.pack(sid

[Tutor] Reading binary files #2

2009-02-09 Thread etrade . griffiths
Hi following last week's discussion with Bob Gailer about reading unformatted FORTRAN files, I have attached an example of the file in ASCII format and the equivalent unformatted version. Below is some code that works OK until it gets to a data item that has no additional associated data, the

Re: [Tutor] Picking up citations

2009-02-09 Thread Kent Johnson
On Sun, Feb 8, 2009 at 7:07 PM, Dinesh B Vadhia wrote: > Hi Kent > > From pyparsing to PLY in a few days ... this is too much to handle! I tried > the program and like you said it works except for the inclusion of the full > name. I tested it on different text and it doesn't work as expected (se

Re: [Tutor] UPDATED: Question on how to open other programs and files

2009-02-09 Thread spir
Le Sun, 8 Feb 2009 19:05:59 -0800, Hi a écrit : > Sorry for being confusing on my last e-mail. I will try to clarify my > intents a bit further. In short, I want to be able to read the data in the > file as well as launch document viewer in Python. For one of the files I > want to read the data f

Re: [Tutor] UPDATED: Question on how to open other programs andfiles

2009-02-09 Thread Alan Gauld
"Hi" wrote In short, I want to be able to read the data in the file as well as launch document viewer in Python. For one of the files I want to read the data from a Python script that's in the same folder as the GUI Python script. OK, You need to be really clear about what you mean. Do you