Re: [Tutor] Available filetypes for AskSaveasfilenam in Tkinter?

2009-01-22 Thread Wayne Watson
The PIL handbook shows 30 or more formats. The tutorial has more to say about details. Very good. Thanks. John Fouhy wrote: 2009/1/23 Wayne Watson : Continuing. The code that is eventually used to do the save is: === def SaveGIF(self): if self.current_

Re: [Tutor] Available filetypes for AskSaveasfilenam in Tkinter?

2009-01-22 Thread John Fouhy
2009/1/23 Wayne Watson : > Continuing. The code that is eventually used to do the save is: > === > def SaveGIF(self): > if self.current_path: > default_path = splitext(basename(self.current_path))[0] + ".gif" > path = asksaveasfilename(defaultext

Re: [Tutor] Available filetypes for AskSaveasfilenam in Tkinter?

2009-01-22 Thread Wayne Watson
Continuing.  The code that is eventually used to do the save is: ===     def SaveGIF(self):     if self.current_path:     default_path = splitext(basename(self.current_path))[0] + ".gif"     path = asksaveasfilename(defaultextension=".gif",   

Re: [Tutor] Available filetypes for AskSaveasfilenam in Tkinter?

2009-01-22 Thread John Fouhy
2009/1/23 Wayne Watson : > What I'm getting at it is when I see something in a program as: > path = asksaveasfilename(defaultextension=".jpg", > title="Save as JPEG", > initialfile=default_path, >

Re: [Tutor] Available filetypes for AskSaveasfilenam in Tkinter?

2009-01-22 Thread Wayne Watson
Title: Signature.html What I'm getting at it is when I see something in a program as:     path = asksaveasfilename(defaultextension=".jpg", title="Save as JPEG", initialfile=default_path,  

Re: [Tutor] Available filetypes for AskSaveasfilenam in Tkinter?

2009-01-22 Thread John Fouhy
2009/1/23 Wayne Watson : > And if I pass it, 'pcx', 'fits', 'dog', 'cat', ...? I don't understand your question. You can certainly do this: tkFileDialog.asksaveasfilename(filetypes=[('PCX files', '*.pcx'), ('FITS files', '*.fits'), ('Dogs', '*.dog')]) If that's not what you want, you need to ex

Re: [Tutor] Available filetypes for AskSaveasfilenam in Tkinter?

2009-01-22 Thread Wayne Watson
Title: Signature.html And if I pass it, 'pcx', 'fits', 'dog', 'cat', ...? John Fouhy wrote: 2009/1/23 Wayne Watson : How do I know what file types are available for asksaveasfilename? Suppose one isn't available, for example, FITS. How do I get it? You pass the file typ

Re: [Tutor] Available filetypes for AskSaveasfilenam in Tkinter?

2009-01-22 Thread John Fouhy
2009/1/23 Wayne Watson : > How do I know what file types are available for asksaveasfilename? Suppose > one isn't available, for example, FITS. How do I get it? You pass the file types as an argument to the function. tkFileDialog.asksaveasfilename(filetypes=[('Text', '*.txt'), ('Stuff', '*.stf'),

[Tutor] Available filetypes for AskSaveasfilenam in Tkinter?

2009-01-22 Thread Wayne Watson
Title: Signature.html How do I know what file types are available for asksaveasfilename? Suppose one isn't available, for example, FITS. How do I get it? -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)

Re: [Tutor] class design - base classes with optional properties?

2009-01-22 Thread Kent Johnson
On Thu, Jan 22, 2009 at 6:24 PM, Alan Gauld wrote: > "Marcus Goldfish" wrote > >> I'm trying to design a base class for a hierarchy. The properties I want >> to >> specify for the base class depend on the values of other properties of the >> base class. > > Don't worry so much about the properti

Re: [Tutor] class arguments?

2009-01-22 Thread Alan Gauld
"Alan Gauld" wrote is there a way to give arguments to a class definition? I see that Kent interpreted your question differently to me. If you do mean that you want to dynamically define class attributes rather than instance attributes then __init__() won't work. But I'd be interested to

Re: [Tutor] class design - base classes with optional properties?

2009-01-22 Thread Alan Gauld
"Marcus Goldfish" wrote I'm trying to design a base class for a hierarchy. The properties I want to specify for the base class depend on the values of other properties of the base class. Don't worry so much about the properties, the important thing to focus on in your base classes is the

Re: [Tutor] class arguments?

2009-01-22 Thread Kent Johnson
On Thu, Jan 22, 2009 at 5:18 PM, Kent Johnson wrote: > On Thu, Jan 22, 2009 at 4:51 PM, spir wrote: >> Hello, >> >> is there a way to give arguments to a class definition? Eg >> >> class MonoList(list, typ, number): >>item_type = typ >>item_number = number > > Use the type() funct

Re: [Tutor] class arguments?

2009-01-22 Thread Kent Johnson
On Thu, Jan 22, 2009 at 4:51 PM, spir wrote: > Hello, > > is there a way to give arguments to a class definition? Eg > > class MonoList(list, typ, number): >item_type = typ >item_number = number Use the type() function (which is the constructor for the type 'type') to dynamically

Re: [Tutor] class arguments?

2009-01-22 Thread Alan Gauld
"spir" wrote is there a way to give arguments to a class definition? Eg class MonoList(list, typ, number): item_type = typ item_number = number Yes thats what the __init__ method is for. class MonoList: def __init__(self, lst, typ, num): self.item_type = typ self.number = num

[Tutor] class arguments?

2009-01-22 Thread spir
Hello, is there a way to give arguments to a class definition? Eg class MonoList(list, typ, number): item_type = typ item_number = number [I guess you understand what I try to do...] denis -- la vida e estranya ___ Tutor maillist

Re: [Tutor] class design - base classes with optional properties?

2009-01-22 Thread Kent Johnson
On Thu, Jan 22, 2009 at 3:04 PM, Marcus Goldfish wrote: > I'm trying to design a base class for a hierarchy. The properties I want to > specify for the base class depend on the values of other properties of the > base class. For instance, in this toy example of a base FoodProcessor > class: > cl

Re: [Tutor] Writing long strings (that include commas) to a csv file

2009-01-22 Thread Kent Johnson
On Thu, Jan 22, 2009 at 2:33 PM, Judith Flores wrote: > Hello dear Python experts, > > How can I write a complete string (which sometimes will include many commas) > to a cell in a CSV file? With the code below, what I obtain is a cell per > letter of every string: > > > file1=open('myfile.csv',

[Tutor] class design - base classes with optional properties?

2009-01-22 Thread Marcus Goldfish
I'm trying to design a base class for a hierarchy. The properties I want to specify for the base class depend on the values of other properties of the base class. For instance, in this toy example of a base FoodProcessor class: class FoodProcessor: "Model for a kitchen appliance food processo

[Tutor] Writing long strings (that include commas) to a csv file

2009-01-22 Thread Judith Flores
Hello dear Python experts, How can I write a complete string (which sometimes will include many commas) to a cell in a CSV file? With the code below, what I obtain is a cell per letter of every string: file1=open('myfile.csv','w') writer=csv.writer(file1) mylist=[ " first , txt+words , more"

Re: [Tutor] fetching wikipedia articles

2009-01-22 Thread Andre Engels
On Thu, Jan 22, 2009 at 6:08 PM, amit sethi wrote: > hi , I need help as to how i can fetch a wikipedia article i tried changing > my user agent but it did not work . Although as far as my knowledge of > robots.txt goes , looking at en.wikipedia.org/robots.txt it does not seem it > should block a

[Tutor] fetching wikipedia articles

2009-01-22 Thread amit sethi
hi , I need help as to how i can fetch a wikipedia article i tried changing my user agent but it did not work . Although as far as my knowledge of robots.txt goes , looking at en.wikipedia.org/robots.txt it does not seem it should block a useragent (*, which is what i would normally use) from acces

Re: [Tutor] profiling python code

2009-01-22 Thread Kent Johnson
On Thu, Jan 22, 2009 at 4:18 AM, Norman Khine wrote: > Hello, > > I have this output when running the profile on one of my modules: > It's a bit easier to intepret with the headers: ncalls tottime percall cumtime percall filename:lineno(function) > 9815/96440.0090.0000.0090.0

Re: [Tutor] dict() versus {}

2009-01-22 Thread Kent Johnson
On Wed, Jan 21, 2009 at 10:54 PM, wormwood_3 wrote: > When creating a list of dictionaries through a loop, I ran into a strange > issue. I'll let the code talk: t = [] for thing in l: > ... t.append(dict(thing=1)) > ... t > [{'thing': 1}, {'thing': 1}, {'thing': 1}, {'thing': 1

[Tutor] profiling python code

2009-01-22 Thread Norman Khine
Hello, I have this output when running the profile on one of my modules: 9815/96440.0090.0000.0090.000 {len} 60.0000.0000.0000.000 {locals} 50.0000.0000.0010.000 {map} 10.0000.0000.0000.000 {math.exp}