Re: [Tutor] What is this [] construction?

2009-03-03 Thread Alan Gauld
"Andre Engels" wrote What is this: d = [ int(x) for x in s.split(":") ] That's called list comprehension. The notation [f(x) for x in A if p(x)] means: Form a list in the following way: For Wayne's benefit... You will also find a similar construction in parens called a generator expressio

Re: [Tutor] Convert XML codes to "normal" text?

2009-03-03 Thread Senthil Kumaran
On Wed, Mar 4, 2009 at 11:13 AM, Eric Dorsey wrote: > I know, for example, that the > code means >, but what I don't know is > how to convert it in all my data to show properly? I Feedparser returns the output in html only so except html tags and entities in the output. What you want is to Unesca

Re: [Tutor] Convert XML codes to "normal" text?

2009-03-03 Thread Lie Ryan
Eric Dorsey wrote: _So here is my program, I'm pulling some information off of my Snipt feed .._ I know, for example, that the > code means >, but what I don't know is how to convert it in all my data to show properly? In all the feedparser examples it just smoothly has the output correct

[Tutor] Convert XML codes to "normal" text?

2009-03-03 Thread Eric Dorsey
*So here is my program, I'm pulling some information off of my Snipt feed .. * import feedparser d = feedparser.parse('http://snipt.net/dorseye/feed') x=0 for i in d['entries']: print d['entries'][x].title print d['entries'][x].summary print x+=1 *Output* Explode / Implode List

[Tutor] Code documentation

2009-03-03 Thread Carlos Daniel Ruvalcaba Valenzuela
Hello list, I have been coding in python a short while and I have been wondering which approach should I take on documentation (API docs) for a python library I have been working on, there is currently code docstrings, docstrings with some markup (epydoc, etc), or external programs such as Sphinx

Re: [Tutor] What is this [] construction?

2009-03-03 Thread Marc Tompkins
On Tue, Mar 3, 2009 at 7:01 PM, Lie Ryan wrote: > Marc Tompkins wrote: > > List comprehensions will make your head hurt the first few dozen times > >> you encounter them. After that, they become easier to use than the longer >> for-loop structure they replace - as André pointed out, they read a

Re: [Tutor] What is this [] construction?

2009-03-03 Thread Lie Ryan
Marc Tompkins wrote: > List comprehensions will make your head hurt the first few dozen times you encounter them. After that, they become easier to use than the longer for-loop structure they replace - as André pointed out, they read almost like English. I have to disagree, I immediately fell

Re: [Tutor] Configuration File, Tkinter, IntVars--Manufacturing Variables

2009-03-03 Thread Wayne Watson
Title: Signature.html Memory malfunction. I've been using the program to add features so much with IDLE my brain went IDLE. One starts it by double clicking on the py file. It is possible some users might have drifted off into IDLE though, but unlikely. Wayne Watson wrote: Nope. I just tr

Re: [Tutor] Configuration File, Tkinter, IntVars--Manufacturing Variables

2009-03-03 Thread Wayne Watson
Title: Signature.html There's another way? Alan Gauld wrote: "Wayne Watson" wrote Note though the use of control variables like IntVar, etc. FWIW. Personally I never use those "convenience" features of Tk. I prefer to explicitly set and get them myself. Alan G ___

Re: [Tutor] Configuration File, Tkinter, IntVars--Manufacturing Variables

2009-03-03 Thread Wayne Watson
Title: Signature.html Nope. I just tried it. It works fine from there. Interesting, as far as I know, the author wanted us to run it from IDLE. That may explain some other oddities.  I'll check with him. I'm quite sure in his user manual he never talks about the command console. Alan Gauld wro

Re: [Tutor] Configuration File, Tkinter, IntVars--Manufacturing Variables

2009-03-03 Thread Alan Gauld
"Wayne Watson" wrote Note though the use of control variables like IntVar, etc. FWIW. Personally I never use those "convenience" features of Tk. I prefer to explicitly set and get them myself. Alan G ___ Tutor maillist - Tutor@python.org http

Re: [Tutor] Configuration File, Tkinter, IntVars--Manufacturing Variables

2009-03-03 Thread Wayne Watson
Title: Signature.html An interesting thought, I'll ponder it. Note though the use of control variables like IntVar, etc. In the 2000 line original version of all the program, integers, dates, and booleans are in use for the simplified widget I produced. Note to the use of self.anumberVar.set. (

Re: [Tutor] Configuration File, Tkinter, IntVars--Manufacturing Variables

2009-03-03 Thread Wayne Watson
Title: Signature.html I browsed through your response, and it looks like this may be doable. I'll look this over more carefully this evening. It seems as though someone should have had a similar problem in the past. The Tkinter interface seems to be a, I hope, temporary logjam. I don't recall X

Re: [Tutor] Configuration File, Tkinter, IntVars--Manufacturing Variables

2009-03-03 Thread Alan Gauld
"Wayne Watson" wrote Comments? class IntVar_GUI: I just noticed the name of the class. This kind of implies that you are intending writing GUIs for each data type? That shouldn't be necessary since the inputs will be strings in each case. You only need to call the appropriate conversion

Re: [Tutor] Configuration File, Tkinter, IntVars--Manufacturing Variables

2009-03-03 Thread Alan Gauld
destroy() took care of it, but I wonder what advantage there was to Quit()? destroy destroys the widget, quit exits the main loop. destroying the top level widget usually causes the mainloop; to die too so the end result is the same (provided you have no non-modal dialogs open?). HTH, Ala

Re: [Tutor] Configuration File, Tkinter, IntVars--Manufacturing Variables

2009-03-03 Thread Alan Gauld
"Wayne Watson" wrote BTW, the Quit function is original but doesn't kill the window when Quit is used. Does that include running from the command console? Is this another IDLE/Tkinter issue maybe? Alan G. ___ Tutor maillist - Tutor@python.

Re: [Tutor] Configuration File, Tkinter, IntVars--Manufacturing Variables

2009-03-03 Thread Alan Gauld
"Wayne Watson" wrote see my post of yesterday, "Maintaining the Same Variable Type--Tkinter", went over like a lead balloon. :-) Yeah, I had no idea what you meant :-) I've heavily modified the original code to accept a config file, and set up variable to initialize the widgets, trying to

Re: [Tutor] Configuration File, Tkinter, IntVars--Manufacturing Variables

2009-03-03 Thread Wayne Watson
Title: Signature.html WW,     good. Thanks. destroy() took care of it, but I wonder what advantage there was to Quit()? WW W W wrote: On Tue, Mar 3, 2009 at 1:54 PM, Wayne Watson wrote: BTW, the Quit function is original but doesn't kill the window when Quit is used. What fixe

Re: [Tutor] Difference in minutes between two time stamps

2009-03-03 Thread Tim Michelsen
import datetime s = '09:35:23' datetime.datetime.strptime(s, '%H:%M:%S') datetime.datetime(1900, 1, 1, 9, 35, 23) Can you figure out how to proceed from there? In case she doesn't know: import datetime as dt start="09:35:23" end="10:23:00" start_dt = dt.datetime.strptime(start, '%H:%

Re: [Tutor] Difference in minutes between two time stamps

2009-03-03 Thread Tim Michelsen
import datetime s = '09:35:23' datetime.datetime.strptime(s, '%H:%M:%S') datetime.datetime(1900, 1, 1, 9, 35, 23) Can you figure out how to proceed from there? In case she doesn't know: import datetime as dt start="09:35:23" end="10:23:00" start_dt = dt.datetime.strptime(start, '%H:%M:

Re: [Tutor] Configuration File, Tkinter, IntVars--Manufacturing Variables

2009-03-03 Thread W W
On Tue, Mar 3, 2009 at 1:54 PM, Wayne Watson wrote: > > BTW, the Quit function is original but doesn't kill the window when Quit is > used. What fixes that? For more bonus points, it seems as though the try > statement in the dialog should really bring up an "Error" dialog saying > something is wr

[Tutor] Configuration File, Tkinter, IntVars--Manufacturing Variables

2009-03-03 Thread Wayne Watson
Title: Signature.html I see my post of yesterday, "Maintaining the Same Variable Type--Tkinter", went over like a lead balloon. :-) (Note though the Myth Busters TV series successfully built and flew a lead balloon.) Let's see if I can really simplify what I'm after. I've pulled the essential

Re: [Tutor] Shelve: remove dictionary from list

2009-03-03 Thread Kent Johnson
On Tue, Mar 3, 2009 at 12:18 PM, Timo wrote: > Hello all, I'm using the Shelve module to store dictionaries in a list as a > value of a key. > > So: > > key = [{'keyA' : 1, 'keyB' : 2}, {'key1' : 1, 'key2' : 2}] > > The problem is I can't remove a dictionary from the list. > > > import shelve > >

[Tutor] Shelve: remove dictionary from list

2009-03-03 Thread Timo
Hello all, I'm using the Shelve module to store dictionaries in a list as a value of a key. So: key = [{'keyA' : 1, 'keyB' : 2}, {'key1' : 1, 'key2' : 2}] The problem is I can't remove a dictionary from the list. import shelve s = shelve.open('file') try: for index, value in enumerate(s[

Re: [Tutor] animation with Tkinter canvas

2009-03-03 Thread W W
On Tue, Mar 3, 2009 at 3:05 AM, Mr Gerard Kelly wrote: > Hello, I am attempting to make a simple animation of a vibrating string using > Tkinter canvas. > I haven't been able to find much information on how to do it. > I have my data of position x on the string at time t. I can plot it > with > r

[Tutor] animation with Tkinter canvas

2009-03-03 Thread Mr Gerard Kelly
Hello, I am attempting to make a simple animation of a vibrating string using Tkinter canvas. I haven't been able to find much information on how to do it. I have my data of position x on the string at time t. I can plot it with Tkinter showing the string for all times at once: width=1500 height

[Tutor] Touchscreen GUI for PyKaraoke - Job in London

2009-03-03 Thread Alexander Telford
Hi, I am looking for someone to write a touchscreen GUI for PyKaraoke ( http://www.kibosh.org/pykaraoke/). Looking for someone based in or around London with a lot of experience of Python and Linux who willl be able to complete this project quickly. Knowledge of sound and video processing on Linux

Re: [Tutor] What is this [] construction?

2009-03-03 Thread Marc Tompkins
On Mon, Mar 2, 2009 at 11:18 PM, Andre Engels wrote: > On Tue, Mar 3, 2009 at 4:54 AM, Wayne Watson > wrote: > >self.recent_events = [ event for event in self.recent_events > >if os.path.exists(event) and > >(time.time() - o