Re: [Tutor] Python hosting again

2005-08-15 Thread Adam Cripps
On 8/11/05, Jorge Louis De Castro <[EMAIL PROTECTED]> wrote: > > > Hello, > > I'm interested in writing with my own Python implementation of a Jabber IM > server and client. > Anyone knows where I could host my Python Jabber IM server for a reasonable > monlthy fee? It doesn't need to be

[Tutor] Replacement for 'Find' Module

2005-08-15 Thread Don Parris
On my Windows XP box running Python 2.4, I attempted to use the 'find' module per the example in Programming Python (Ch. 2) - i.e.: >>>import find >>>find.find('*') However, Python didn't find the find module. The docs say it's now deprecated, but don't point to what tool should be used to replac

Re: [Tutor] parsing through an output stream

2005-08-15 Thread Alan G
> read the returned output stream in non-blocking mode. But, I did > not getting any of the status messages given out by mplayer Traditionally status messages tend to be sent to stderr rather than stdout (this means that they don't break Unix pipelines). But that means that to read them you will

Re: [Tutor] Is it possible to...

2005-08-15 Thread jfouhy
Quoting Nathan Pinno <[EMAIL PROTECTED]>: > Is it possible to create a def that not only deals cards, but also > assigns a value to each rank, except that the Jacks, Queens, and Kings > all are the same value as the 10s? > If this is possible, how should I go about doing this? Nearly everything i

Re: [Tutor] Replacement for 'Find' Module

2005-08-15 Thread Simon Gerber
You could probably do something like this... (Note: This example is for Linux - but you can adapt it fairly easily to Windows.) # E.g. Find every .inf file on a CD-ROM. path = '/cdrom' # 'E:\\' or whatever for Windows inf_list = [] for root, dirs, files in os.walk(path): for current_fi

Re: [Tutor] How can I make this run right?

2005-08-15 Thread Simon Gerber
I'd do it like this... And there's probably an even quicker way, if you really sat down and thought about it. n = int(raw_input("Number: ")) x = n-1 while x > 1: n *=x x -=1 print n The reason why it isn't working is because of " while x > 1: x -= 1 " When your program hits this p

Re: [Tutor] Is it possible to...

2005-08-15 Thread Alan G
> Is it possible to create a def that not only deals cards, but also > assigns a value to each rank, except that the Jacks, Queens, and > Kings > all are the same value as the 10s? Yes. And you probably need to use a dictionary to hold the value against the card. > Sorry if I'm asking what for

Re: [Tutor] How can I make this run right?

2005-08-15 Thread Alan G
> The following code is supposed to take in a number, and print > number!: > n = int(raw_input("Number: ")) > x = n-1 > while 1: >t = n*x >while x > 1: >x -= 1 >else: >break > print t > > Why isn't it working, and how can I make it print out the correct > output? So g

Re: [Tutor] How can I make this run right?

2005-08-15 Thread Alan G
> The following code is supposed to take in a number, and print > number!: > n = int(raw_input("Number: ")) > x = n-1 > while 1: >t = n*x >while x > 1: >x -= 1 >else: >break > print t > > Why isn't it working, and how can I make it print out the correct > output? So g

[Tutor] Event handler for optionmenu

2005-08-15 Thread Jorge Louis De Castro
Hi,   I have an optionmenu widget that works just fine except that  can't find docs to get hold of events as they happen, kinda like the command=XYZ of other widgets like buttons.   The code I'm using for the option menu is the following:   OPTIONS = ["en","pt","es","it","fr","de"]self.start

Re: [Tutor] Event handler for optionmenu

2005-08-15 Thread geon
Jorge Louis De Castro napsal(a): Hi,   I have an optionmenu widget that works just fine except that  can't find docs to get hold of events as they happen, kinda like the command=XYZ of other widgets like buttons.   The code I'm using for the option menu is the following:  

Re: [Tutor] How can I make this run right?

2005-08-15 Thread R. Alan Monroe
> The following code is supposed to take in a number, and print number!: > n = int(raw_input("Number: ")) > x = n-1 > while 1: > t = n*x > while x > 1: > x -= 1 > else: > break > print t > Why isn't it working, and how can I make it print out the correct output? One th

[Tutor] web gallery

2005-08-15 Thread paul . hendrick
Hi All, I'd like to write some web gallery software from scratch for my girlfriend. I've looked at the PIL (python imaging library) and I'm using it to generate thumbnails from given images. Something else i'd like to get done now though, is building an index of images. Are there any libs suited fo

[Tutor] Would like some help

2005-08-15 Thread Howard Kao
Directly Quoted From the Python Cookbook 1.3 Constructing a Dictionary Without Excessive Quoting Credit: Brent Burley 1.3.1 Problem You'd like to construct a dictionary without having to quote the keys. 1.3.2 Solution Once you get into the swing of Python, you may find yourself construct

Re: [Tutor] Sorting a list of lists aka nested lists

2005-08-15 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Note that in Python2.4+, you can use key= instead: > > def sortKey(lst): > return lst[2] > Quant.sort(key=sortKey) > > This is more effient than specifying a different comparison function, because > the key function is only called once for each element. And instead of

Re: [Tutor] Event handler for optionmenu

2005-08-15 Thread Jorge Louis de Castro
Hi, Thanks for your reply. It wasn't lazyness, believe me, I did look around for solutions and found something similar to yours here: http://www.astro.washington.edu/owen/TkinterSummary.html#TracingVariables The problem is that I have a class and it wants the callback function to be a global n

Re: [Tutor] Event handler for optionmenu

2005-08-15 Thread geon
Jorge Louis de Castro napsal(a): >Hi, > >Thanks for your reply. It wasn't lazyness, believe me, I did look around for >solutions and found something similar to yours here: > >http://www.astro.washington.edu/owen/TkinterSummary.html#TracingVariables > >The problem is that I have a class and it wan

Re: [Tutor] Would like some help

2005-08-15 Thread luke
Howard, I believe what's happening in the second example is that you can combine dictionaries. ... >>>d2 = {'hello':1,'hi':2} >>>print d2.items() [('hi',2),('hello',1)] so in the second example you can just pass it a list of elements (.items()) and it will concatenate (append?) these to the new di

[Tutor] LiveWires problems

2005-08-15 Thread Michael Murphy
Hi all I'm having problems with installing LiveWire for python for Linux (Linspire 5.0 to be exact) and I'm having trouble compiling setup.py. Heres the results: running install running build running build_py running install_lib creating /usr/lib/python2.3/site-packages/livewires error: could not

Re: [Tutor] Would like some help

2005-08-15 Thread Kent Johnson
Howard Kao wrote: > Directly Quoted From the Python Cookbook > Once you get into the swing of Python, you may find yourself > constructing a lot of dictionaries. However, the standard way, also > known as a dictionary display, is just a smidgeon more cluttered than > you might like, due to

Re: [Tutor] LiveWires problems

2005-08-15 Thread ZIYAD A. M. AL-BATLY
On Mon, 2005-08-15 at 11:52 -0400, Michael Murphy wrote: > Hi all > > I'm having problems with installing LiveWire for python for Linux > (Linspire 5.0 to be exact) and I'm having trouble compiling setup.py. > Heres the results: > > running install > running build > running build_py > running ins

Re: [Tutor] How can I make this run right?

2005-08-15 Thread Nathan Pinno
I put in a 4 and expected 24, and instead got 12. It is supposed to give 4! not 4*3. --- Early to bed, Early to rise, Makes a man healthy, wealthy, and wise. --Benjamin Franklin

Re: [Tutor] How can I make this run right?

2005-08-15 Thread luke
> I put in a 4 and expected 24, and instead got 12. It is supposed to give 4! > not 4*3. [snip rest of message] nathan your problem is easy to see... > >> n = int(raw_input("Number: ")) > >> x = n-1 > >> while 1: > >>t = n*x > >>while x > 1: > >>x -= 1 > >>else: > >>br

Re: [Tutor] How can I make this run right?

2005-08-15 Thread geon
Nathan Pinno napsal(a): >I put in a 4 and expected 24, and instead got 12. It is supposed to give 4! >not 4*3. >--- > > Dear Nathan, Everyone is giving you very good hints but seems to me you keep to resist :-) Looks like you always

Re: [Tutor] web gallery

2005-08-15 Thread Luis N
On 8/15/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi All, > > I'd like to write some web gallery software from scratch for my girlfriend. > I've looked at the > PIL (python imaging library) and I'm using it to > generate thumbnails from given images. > Something else i'd like to get done

Re: [Tutor] Python hosting again

2005-08-15 Thread Luis N
On 8/11/05, Jorge Louis De Castro <[EMAIL PROTECTED]> wrote: > Hello, > > I'm interested in writing with my own Python implementation of a Jabber IM > server and client. > Anyone knows where I could host my Python Jabber IM server for a reasonable > monlthy fee? It doesn't need to be a top-not

Re: [Tutor] Replacement for 'Find' Module

2005-08-15 Thread Luis N
On 8/15/05, Simon Gerber <[EMAIL PROTECTED]> wrote: > You could probably do something like this... (Note: This example is > for Linux - but you can adapt it fairly easily to Windows.) > > > # E.g. Find every .inf file on a CD-ROM. > path = '/cdrom' > # 'E:\\' or whatever for Windows > inf_lis

Re: [Tutor] How can I make this run right?

2005-08-15 Thread Alan G
>I put in a 4 and expected 24, and instead got 12. It is supposed to >give 4! > not 4*3. Thanks Nathan. It would be good to get that kind of detail when you post the initial message. Your function didn't look like the usual factorial function. FWIW here is my version :-) def factorial(n):

[Tutor] convert a file from plaintext(Ascii) to unicode? very quick questions

2005-08-15 Thread D. Hartley
Hello guys! Is there a way to convert a file from plaintext(Ascii) to unicode? I have found all my notes about moving between hex., int's, chr's, ord's, etc, but all of these things were only riddle exercises to me and I have a hard time keeping them straight. I'm pretty sure I knew the answer t

Re: [Tutor] convert a file from plaintext(Ascii) to unicode? very quickquestions

2005-08-15 Thread luke
um... >>> help(unicode) Help on class unicode in module __builtin__: [snip help stuff] | encode(...) | S.encode([encoding[,errors]]) -> string or unicode | | Encodes S using the codec registered for encoding. encoding defaults | to the default encoding. errors may be given to s

Re: [Tutor] Would like some help

2005-08-15 Thread Howard Kao
Thanks for the help Luke and Kent. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] convert a file from plaintext(Ascii) to unicode? very quickquestions

2005-08-15 Thread luke
List: I'm forwarding this private message(hope you don't mind Denise) I personally have no idea what to do, but someone else might be able to help. -Luke - Forwarded Message - text is a list, so you can't encode it. but you can iterate over each of the elements and encode them. I have

Re: [Tutor] convert a file from plaintext(Ascii) to unicode? very quick questions

2005-08-15 Thread Bob Gailer
At 06:49 PM 8/15/2005, D. Hartley wrote: >Hello guys! > >Is there a way to convert a file from plaintext(Ascii) to unicode? I >have found all my notes about moving between hex., int's, chr's, >ord's, etc, but all of these things were only riddle exercises to me >and I have a hard time keeping them

[Tutor] From file2.py append an item to file1.py combobox

2005-08-15 Thread _ Dan _
Hi to all: How can I append some data from file1.py to a combobox on file2.py? I know, if you want to append data to a combobox inside the same script, I would be like follows: # file1.py import wx class Myframe(wx.Frame): def __init__(self, *args, **kwds): ... self.mycombobox = wx.Combo

Re: [Tutor] convert a file from plaintext(Ascii) to unicode? very quickquestions

2005-08-15 Thread Kent Johnson
I think Luke's suggestion will work if you use f.read() (to read the whole file as a single string) instead of f.readlines() and f.write() instead of writelines(). Kent luke wrote: > List: > I'm forwarding this private message(hope you don't mind Denise) > I personally have no idea what to do,