Re: [Tutor] Sorting a List

2011-01-12 Thread Peter Otten
Bill Campbell wrote: > On Wed, Jan 12, 2011, Corey Richardson wrote: >>Hello Tutors, >> >>I am generating XML definitions for animations to be used in a >>FIFE-based game. I need to sort the frames of the animations, and I am >>currently using: >>sorted([image for image in os.listdir(path) if imag

Re: [Tutor] Sorting a List

2011-01-12 Thread Corey Richardson
On 01/12/2011 09:42 PM, Luke Paireepinart wrote: > Remember the sorted() method takes a key function, have this key > function take in each filename and compare the numbers and you're all set! > > - > Sent from a mobile device. Apologies for brevity and top-posting. > -

Re: [Tutor] Command line scripts

2011-01-12 Thread David Hutto
Although, you did just that, didn't pay attention to the whole thing. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Command line scripts

2011-01-12 Thread David Hutto
Although, I'd just go with a function that gets passed the text, that way it was reusable, like the one I gave. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Command line scripts

2011-01-12 Thread David Hutto
I think it works great as an easy integration for the blind(although I'm sure there is already a python module for that somewhere), as long as they have espeak(or it can be easily adapted), but also if you just like the ai feel of a voice in your apps. __

Re: [Tutor] Command line scripts

2011-01-12 Thread David Abbott
On Wed, Jan 12, 2011 at 9:29 PM, David Hutto wrote: > On Sun, Jan 9, 2011 at 9:03 AM, ALAN GAULD wrote: >> >> >>> The following line is what I mean by calling a  command line from within the >>>app >>> using subprocess. >>> >>> self.espeak =  subprocess.Popen(['espeak', word],stdout  = >>> subpro

Re: [Tutor] Sorting a List

2011-01-12 Thread Luke Paireepinart
Remember the sorted() method takes a key function, have this key function take in each filename and compare the numbers and you're all set! - Sent from a mobile device. Apologies for brevity and top-posting. - On Jan 12, 2011, at 8:17 PM, B

Re: [Tutor] Command line scripts

2011-01-12 Thread David Hutto
On Sun, Jan 9, 2011 at 9:03 AM, ALAN GAULD wrote: > > >> The following line is what I mean by calling a  command line from within the >>app >> using subprocess. >> >> self.espeak =  subprocess.Popen(['espeak', word],stdout  = >> subprocess.PIPE).communicate()[0] > > OK, Now I understand. > You wan

Re: [Tutor] Sorting a List

2011-01-12 Thread Bill Allen
Corey, I have a bit of code that use in a CGI that sorts some picture files, perhaps something like this will work for you. The file sorting bit: dir_list = os.listdir("/localhost/html/pics") dir_list.sort() #sorts the list of filenames in place Just in case there is something else useful in th

Re: [Tutor] Sorting a List

2011-01-12 Thread Bill Campbell
On Wed, Jan 12, 2011, Corey Richardson wrote: >Hello Tutors, > >I am generating XML definitions for animations to be used in a >FIFE-based game. I need to sort the frames of the animations, and I am >currently using: >sorted([image for image in os.listdir(path) if image.endswith('.png')]) > >The fi

Re: [Tutor] Sorting a List

2011-01-12 Thread Emile van Sebille
On 1/12/2011 4:56 PM Corey Richardson said... Hello Tutors, I am generating XML definitions for animations to be used in a FIFE-based game. I need to sort the frames of the animations, and I am currently using: sorted([image for image in os.listdir(path) if image.endswith('.png')]) I might use

[Tutor] Sorting a List

2011-01-12 Thread Corey Richardson
Hello Tutors, I am generating XML definitions for animations to be used in a FIFE-based game. I need to sort the frames of the animations, and I am currently using: sorted([image for image in os.listdir(path) if image.endswith('.png')]) The final output in the XML is:

Re: [Tutor] question regarding regular expression compile

2011-01-12 Thread Luke Paireepinart
No. Did you try that? It doesn't evn look like valid python code to me. You want a single string with the r before it, not 3 separate strings. - Sent from a mobile device. Apologies for brevity and top-posting. - On Jan 12, 2011, at 8:02 AM,

Re: [Tutor] python hyperlinks question

2011-01-12 Thread Alan Gauld
"Vikram K" wrote Could you please tell me how to add hyperlinks to my output? The output is just text so all you need to do is find out how Excel populates hyperlinks in a CSV file... If that is actually possible. The easiest way will be to create an Excel file with hyperlinks, save as C

Re: [Tutor] question

2011-01-12 Thread Karim
Hello, "You can even use a StringVar as the checkbutton's variable, and supply string values for the offvalue and onvalue. Here's an example: self.spamVar = StringVar() self.spamCB = Checkbutton ( self, text="Spam?", variable=self.spamVar, onvalue="yes", offvalue="no" ) If this checkbutton is

[Tutor] question

2011-01-12 Thread Stinson, Wynn A Civ USAF AFMC 556 SMXS/MXDED
Can someone give me some sample code to use to determine if a checkbox has been selected using Tkinter? thanks ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] question regarding regular expression compile

2011-01-12 Thread Yaniga, Frank
I believe I had epiphany: test = re.compile('MAT file (billing|carrier|log|util)' r'\\' '\d{8} deleted') is this correct? _ From: Yaniga, Frank Sent: Wednesday, January 12, 2011 8:20 AM To: 'tutor@python.org'; 'h...@python.org' Subject: questi

Re: [Tutor] How to insert a quit-Button in a Tkinter class?

2011-01-12 Thread Karim
/_Sorry my mistake in createLabel() method:_/ self.label = Label(text="") instead of : self.label = *Tkinter*.Label(text="") On 01/12/2011 09:23 PM, Karim wrote: Hello, Inherit from Frame see below: from Tkinter import * class App(Frame): def __init__(self, master=None): Fram

Re: [Tutor] How to insert a quit-Button in a Tkinter class?

2011-01-12 Thread Karim
Hello, Inherit from Frame see below: from Tkinter import * class App(Frame): def __init__(self, master=None): Frame.__init__(self, master) self.grid() self.createLabel() self.createButton() def createLabel(self): self.label = Tkinter.Label(text=

Re: [Tutor] How to insert a quit-Button in a Tkinter class?

2011-01-12 Thread Karim
Hello, Inherit from Frame see below: from Tkinter import * class App(Frame): def __init__(self, master=None): Frame.__init__(self, master) self.grid() self.createLabel() self.createButton() def createLabel(self): self.label = Tkinter.Label(text=

Re: [Tutor] How to insert a quit-Button in a Tkinter class?

2011-01-12 Thread Steve Willoughby
On 12-Jan-11 11:41, Enih Gilead wrote: Hi, all ! I've being strugling a lot trying to insert (just as exemple) a quit-Button in a Tkinter class App with no success... What I get is the clock runing ok, but, the App simply ignores the quit-Button... Why? Maybe I'm missing something, but you def

[Tutor] How to insert a quit-Button in a Tkinter class?

2011-01-12 Thread Enih Gilead
Hi, all ! I've being strugling a lot trying to insert (just as exemple) a quit-Button in a Tkinter class App with no success... What I get is the clock runing ok, but, the App simply ignores the quit-Button... Why? _*Remark*_: I took this minimalist digital clock just to illustrate the "bad

Re: [Tutor] Ideas about global variables for accessing project's file

2011-01-12 Thread Kann Vearasilp
The ConfigParser works perfectly! Thanks a bunch! Kann On Wed, 2011-01-12 at 13:59 +, Alan Gauld wrote: > "Kann Vearasilp" wrote > > > Is there a way to make a global variable for the project to make my > > life > > easier? Sometime like... PROJECT_PATH/src/modules/mod1 which > > PROJECT_

Re: [Tutor] how avoid writing a newline?

2011-01-12 Thread Tommy Kaas
Yes – you’re right! Thanks, Tommy Fra: Jason Staudenmayer [mailto:jas...@adventureaquarium.com] Sendt: 12. januar 2011 16:50 Til: Tommy Kaas; tutor@python.org Emne: RE: [Tutor] how avoid writing a newline? You should have a comma after the "#" in the highlighted print statement, that sho

Re: [Tutor] how avoid writing a newline?

2011-01-12 Thread Jason Staudenmayer
You should have a comma after the "#" in the highlighted print statement, that should repress the new line (I'm guessing that's the line you're talking about) print >> f,t,"#", Jason ..·><º> -Original Message- From: tutor-bounces+jasons=adventureaquarium@python.org [mai

Re: [Tutor] python hyperlinks question

2011-01-12 Thread Luke Paireepinart
Not really a python question, but maybe look at that pyexcel or whatever. Should be able to add links to it that way. Csv is jus a data interchange format though, if excel supports passing links thru it then you can do it, otherwise don't use csv for this. - Sent fro

[Tutor] how avoid writing a newline?

2011-01-12 Thread Tommy Kaas
I'm using Activepython 2.6.6 on PC/Win7 I have made a small scraper script as an exercise for myself. It scrapes the name and some details of the first 25 billionaires on the Forbes list. It works and write the result in a text file, with the columns separated by "#" It takes the name from

[Tutor] python hyperlinks question

2011-01-12 Thread Vikram K
I have a bunch of symbols in one of the columns in my program's output file (a csv file which can be opened in excel). I wish to add hyperlinks to each entry in this particular column in my output file. A sample symbol/entry in the specific column of interest in the output file is USP8 and it needs

Re: [Tutor] question regarding regular expression compile

2011-01-12 Thread Evert Rol
> I am determining a regular expression that can recognize the any of the > following strings: > > MAT file log\20101225 deleted > MAT file billing\20101225 deleted > MAT file util\20101225 deleted > MAT file carrier\20101225 deleted > > I begin by creating a regular expression object so that

Re: [Tutor] question regarding regular expression compile

2011-01-12 Thread Adam Bark
On 12/01/11 13:19, Yaniga, Frank wrote: I am determining a regular expression that can recognize the any of the following strings: MAT file log\20101225 deleted MAT file billing\20101225 deleted MAT file util\20101225 deleted MAT file carrier\20101225 deleted I begin by creating a regular expres

Re: [Tutor] Ideas about global variables for accessing project's file

2011-01-12 Thread Alan Gauld
"Kann Vearasilp" wrote Is there a way to make a global variable for the project to make my life easier? Sometime like... PROJECT_PATH/src/modules/mod1 which PROJECT_PATH should work with every machines. You can use a relative path based on your installatiojn root You can use a config file

[Tutor] question regarding regular expression compile

2011-01-12 Thread Yaniga, Frank
I am determining a regular expression that can recognize the any of the following strings: MAT file log\20101225 deleted MAT file billing\20101225 deleted MAT file util\20101225 deleted MAT file carrier\20101225 deleted I begin by creating a regular expression object so that I can reuse it in m

Re: [Tutor] Ideas about global variables for accessing project's file

2011-01-12 Thread Walter Prins
Hi, On 12 January 2011 13:11, Kann Vearasilp wrote: > Below is the structure of my project > > /src > /src/modules/mod1 > /src/modules/mod2 > /src/data/file1 > /src/data/file2 > > > I wrote some codes in mod1 to access data in file1. And to read the file1, > I am hard coding in the mod1, which i

[Tutor] Ideas about global variables for accessing project's file

2011-01-12 Thread Kann Vearasilp
Dear all, I am new to python and now having a tiny problem about accessing files from python modules I have in my project.. Here is my situation: Below is the structure of my project /src /src/modules/mod1 /src/modules/mod2 /src/data/file1 /src/data/file2 I wrote some codes in mod1 to access d