Re: [Tutor] Rebuild jpg

2011-02-21 Thread Liam Clarke-Hutchinson
Hi Rafael, Do you need to use Python 3.x? If you can use Python 2.6, the Python Imaging Library is a great image manipulation module. http://www.pythonware.com/products/pil/ Regards, Liam Clarke 2011/2/21 Rafael Durán Castañeda > Hi all, > > I'm using Python 3.1 and I have an image of an anim

Re: [Tutor] Tkinter in classes...why?

2011-01-20 Thread Liam Clarke-Hutchinson
Your signature is obscenely large David. > But, the tutorials I have encountered all mentioned that it is supposed to be a good idea to put one's GUI stuff in a class, then create an instance of the class (which I don't entirely understand, since I thought the whole "class" thing was for stuff tha

Re: [Tutor] Timer

2005-12-06 Thread Liam Clarke-Hutchinson
Hi, time.sleep() takes an argument as seconds. Regards, Liam Clarke -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of bob Sent: Wednesday, 7 December 2005 3:59 p.m. To: Joseph Quigley; tutor@python.org Subject: Re: [Tutor] Timer At 06:57 AM 12/6/2005

Re: [Tutor] smtplib mail header problem

2005-12-06 Thread Liam Clarke-Hutchinson
ss is that the spam agent is checking that from_addr, and getting an invalid email address and spitting the dummy. Most ISPs won't allow an invalid from_addr, although mine does.. Regards, Liam Clarke-Hutchinson -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On B

Re: [Tutor] smtplib mail header problem

2005-12-06 Thread Liam Clarke-Hutchinson
Hi Dave, IIRC The first argument to sendmail() is the name of the account that's sending... So when you include your subject there, it seems your ISP is somewhat forgiving. Liam Clarke-Hutchinson| Contact Centre Advisor| Ministry of Economic Development DDI +64 3 962 2639 | Fax +64 3 962

Re: [Tutor] problem with IDLE

2005-12-01 Thread Liam Clarke-Hutchinson
Title: Message IDLE uses localhost (a loopback port 127.0.0.1) to communicate with running scripts (so interrupt keys and debugging calls get passed etc.) It's a nice cross platform method of interprocess communication.   So yeah, 127.0.0.1 is the one. Regards, Liam Clarke-Hutch

Re: [Tutor] Class Inheritance -> NameError

2005-11-30 Thread Liam Clarke-Hutchinson
__ method, then you'll need to call it specifically, or otherwise you'll get a UnboundLocalError, because self.__val/val won't exist. Liam Clarke-Hutchinson -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Johnson Sent: Thursday, 1 Dec

Re: [Tutor] Read Excel file without COM

2005-11-29 Thread Liam Clarke-Hutchinson
Actually, and I'm surprising myself here, but COM would be the easiest way to go about this if you're not able to convert to CSV. If you want to avoid COM, why don't you use it to save each page of the spreadsheet as a CSV file and then go from there? The close tie-in between Excel and COM is desi

Re: [Tutor] Newbie question

2005-11-22 Thread Liam Clarke-Hutchinson
4\Python %1 %2 %3 %4 %5 %6 %7 %8 %9 pause   or similar... Regards, Liam Clarke-Hutchinsonwww.med.govt.nz -Original Message-From: bob [mailto:[EMAIL PROTECTED] Sent: Wednesday, 23 November 2005 10:44 a.m.To: Liam Clarke-Hutchinson; 'Douglass, Erik'; 'tutor

Re: [Tutor] Newbie question

2005-11-22 Thread Liam Clarke-Hutchinson
.   It's not trivial when you're starting. :-)   Regards, Liam Clarke-Hutchinson -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Douglass, ErikSent: Wednesday, 23 November 2005 3:03 a.m.To: tutor@python.orgSubject: [Tutor] Newbie question

Re: [Tutor] smtplib alternative???

2005-11-20 Thread Liam Clarke-Hutchinson
>Generally smtp servers are only configured to send to or from domains in which they belong. Hmmm... several ISP's I've used allow any value in the "From" header field. I'd also like to mention that while many SMTP servers will only allow a valid domain address in the From field, there is usuall

Re: [Tutor] Website monitoring program.

2005-11-20 Thread Liam Clarke-Hutchinson
Ah, this kind of programme would be so much simpler if Last-Modified and ETag were commonly used *sigh*. Unfortunately, advertising kinda killed it... I recommend www.watchthispage.com if you just need a quick update without killing your own bandwidth. Regards, Liam Clarke-Hutchinson

Re: [Tutor] building nonbinary trees

2005-11-17 Thread Liam Clarke-Hutchinson
Erm, a dictionary of names to references? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Vincent Wan Sent: Friday, 18 November 2005 2:21 p.m. To: tutor@python.org Subject: [Tutor] building nonbinary trees I would like to have a tree data structure w

Re: [Tutor] Newb ?

2005-11-17 Thread Liam Clarke-Hutchinson
ometimes to refactor some of the ones I come up with, however. Good rule of thumb is when you're feeling impressed with your own cleverness, you probably need to refactor. (Thanks c2 wiki, for teaching me that.) -Original Message- From: Christian Wyglendowski [mailto:[EMAIL PR

Re: [Tutor] compiled images

2005-11-17 Thread Liam Clarke-Hutchinson
Hehe, Sounds like someone's license was designed for C/C++. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fred Lionetti Sent: Friday, 18 November 2005 8:29 a.m. To: tutor@python.org Subject: [Tutor] compiled images Hi everyone, Thanks everyone fo

Re: [Tutor] Newb ?

2005-11-17 Thread Liam Clarke-Hutchinson
How about - print "\n\nWelcome to the Backwards Message Display." print message = raw_input("\nPlease Enter a Message.") msgAsList = [ char for char in message] msgAsList.reverse() reversedMessage = ''.join(msgAsList) I can't test that, but it should work. But, with regard to - > print "\n\nWel

Re: [Tutor] How to convert a list to tuple

2005-11-16 Thread Liam Clarke-Hutchinson
Does this work? (I can't check) listX = ['933\t957', '955\t979', '969\t993', '1025\t1049', '1052\t1076', '1098\t1122', '1136\t1160', '1298\t1322', '1406\t1430', '1422\t1446', '1471\t1495&

Re: [Tutor] question about ord

2005-11-15 Thread Liam Clarke-Hutchinson
Hmm, Never thought of doing it that way. try - import struct a = theByte value = ord(a) theByteReloaded = struct.pack("i",value) You nmay want to check the docs for the struct module at python.org on that pattern. Liam Clarke-Hutchinson -Original Message- From: [EMAIL

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Liam Clarke-Hutchinson
Someone correct me if I'm wrong, but I believe there is no specific iterator object, but rather objects that have a method for __iter___... Liam Clarke-Hutchinson -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Johnson Sent: Monday, 14 November

Re: [Tutor] Newbie Anxiety

2005-11-10 Thread Liam Clarke-Hutchinson
Title: Message Hi Terry,   Python is great, very much so if the last you used was Basic.   I highly recommend Alan Gauld's tutorial, but I look forward to your queries here. :-) Liam Clarke-Hutchinson -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Beha

Re: [Tutor] [OT] triangulation

2005-11-09 Thread Liam Clarke-Hutchinson
Perl seems to be written in a foreign language. ;) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Fouhy Sent: Thursday, 10 November 2005 2:04 p.m. To: Tutor Subject: Re: [Tutor] [OT] triangulation On 10/11/05, Gregor Lingl <[EMAIL PROTECTED]> wrot

Re: [Tutor] triangulation

2005-11-09 Thread Liam Clarke-Hutchinson
Eek. -Original Message- From: Alan Gauld [mailto:[EMAIL PROTECTED] Sent: Thursday, 10 November 2005 12:07 p.m. To: Liam Clarke-Hutchinson; 'Shi Mu' Cc: tutor@python.org Subject: Re: [Tutor] triangulation > As in Pythagoras? > Or as in triangulation on a 2D surface

Re: [Tutor] image

2005-11-09 Thread Liam Clarke-Hutchinson
Oh dear, I missed that query. Nevermind google, try docs.python.org... -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alex Hunsley Sent: Thursday, 10 November 2005 12:08 p.m. To: Shi Mu Cc: tutor@python.org Subject: Re: [Tutor] image Shi Mu wrote: >any

Re: [Tutor] triangulation

2005-11-09 Thread Liam Clarke-Hutchinson
As in Pythagoras? from math import * c = sqrt(a^2 + b^2) Or as in triangulation on a 2D surface, navigation etc.? from math import * o = tan(theta) * a o = sin(theta) * h h = o/sin(theta) Noting of course that theta defaults to radians. Or, do you mean radio triangulation by directional sign

Re: [Tutor] Testing for gui

2005-11-08 Thread Liam Clarke-Hutchinson
Hmm, no x-server. If you're looking to detect running Python GUI packages, you could check the namespaces for 'em, but beyond that, I'm stumped. -Original Message- From: Ken Stevens [mailto:[EMAIL PROTECTED] Sent: Wednesday, 9 November 2005 1:23 p.m. To: Liam Clarke-Hut

Re: [Tutor] Testing for gui

2005-11-08 Thread Liam Clarke-Hutchinson
Hi Ken, How do you mean? I assume you're referring to a non-Windows environment? In Linux, I'd imagine that using os.popen("ps") would do it. Cheers, Liam -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ken Stevens Sent: Wednesday, 9 November 2005 1

Re: [Tutor] [OTAnn] Feedback

2005-11-08 Thread Liam Clarke-Hutchinson
Oh dear. Is Web 2.01 like that whole Web 2 I've heard so much about, but better? Is it the semantic web, but not so pedantic? Liam Clarke-Hutchinson -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of shenanigans Sent: Wednesday, 9 November 2005

Re: [Tutor] Who called me?

2005-11-08 Thread Liam Clarke-Hutchinson
I believe only by explicitly passing a reference to the parent? Liam Clarke-Hutchinson -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Campbell Sent: Wednesday, 9 November 2005 7:00 a.m. To: Tutor Subject: [Tutor] Who called me? Is there a way in

Re: [Tutor] Does Pygame allow background images?

2005-11-07 Thread Liam Clarke-Hutchinson
if ballrect.top < 0 or ballrect.bottom > height: speed[1] = -speed[1] screen.blit(background, backgroundRect) screen.blit(ball, ballrect) pygame.display.flip() Liam Clarke-Hutchinson -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PRO

Re: [Tutor] Does Pygame allow background images?

2005-11-07 Thread Liam Clarke-Hutchinson
Hi Nathan, Just create a surface the same size as your screen, and have a loop like so while True: Here's some rough code to add a background for that ball one I posted yesterday. Bear in mind that I can't check this at work. Lines with !! are new- import sys, pygame pygame.i

Re: [Tutor] [OT] Mono

2005-11-07 Thread Liam Clarke-Hutchinson
fObj.RedirectStandardError = True process.StartInfo = stInfObj process.Start() (procStdin, procStdOut, procStdErr) = (process.StandardInput, process.StandardOutput, process.StandardError) Liam Clarke-Hutchinson -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On

Re: [Tutor] Easier way to access wxPython

2005-11-07 Thread Liam Clarke-Hutchinson
For wxPython - Wax is alright, Pythoncard is great. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kent Johnson Sent: Tuesday, 8 November 2005 8:31 a.m. Cc: Python Tutor Subject: Re: [Tutor] Easier way to access wxPython Matt Williams wrote: > Dear All

Re: [Tutor] simple report writing?

2005-11-07 Thread Liam Clarke-Hutchinson
Hi RC, >I have a list (x_list) of class data. So, a list of instances/classes then. You'll have to pass a custom function. def tSort(objA,objB): #assuming that objA.x & objB.x are the items to sort by, and are integers if objA < objB: result = -1 elif objA = objB: r

Re: [Tutor] Pygame - was How I use images in a GUI?

2005-11-06 Thread Liam Clarke-Hutchinson
Add another ball, and add collision detection between it and the first ball. Make them double their speed when they hit one wall and halve it when they hit another...   Good luck,   Liam Clarke-Hutchinson      -Original Message-From: Nathan Pinno [mailto:[EMAIL PROTECTED] Sent: Monday, 7 N

Re: [Tutor] Object instances

2005-11-06 Thread Liam Clarke-Hutchinson
Hi DS, I'm not sure what language you've dealt with before, but if it was Java or C++, then you've run into Python's variant of static members. class X(object): classMember = True def __init__(self): self.instanceMember = True Does that make it any clearer? As to the why, I'd

Re: [Tutor] How I use images in a GUI?

2005-11-06 Thread Liam Clarke-Hutchinson
n't. Especially with adding images to shapes on screen. Regards, Liam Clarke-Hutchinson| Contact Centre Advisor| Ministry of Economic Development DDI +64 3 962 2639 | Fax +64 3 962 6220www.med.govt.nz -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTE

Re: [Tutor] Dictionary Error: 'dict' object has noattribute '_con tains_'

2005-11-06 Thread Liam Clarke-Hutchinson
bad enough, but adding implicitness in any form tends to increase my time to debug. I'm learning C at the moment, which has a degree of implicitness that could bite me; ditto C#. Regards, Liam Clarke-Hutchinson -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]

Re: [Tutor] File IO

2005-11-03 Thread Liam Clarke-Hutchinson
Hi Mike, Same file, eh? >From the docs for split() "If sep is not specified or is None, a different splitting algorithm is applied. First, whitespace characters (spaces, tabs, newlines, returns, and formfeeds) are stripped from both ends. Then, words are separated by arbitrary length strings

Re: [Tutor] File IO

2005-11-03 Thread Liam Clarke-Hutchinson
Woah, that's way simpler than mine. Liam Clarke-Hutchinson -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of bob Sent: Friday, 4 November 2005 11:01 a.m. To: [EMAIL PROTECTED]; tutor@python.org Subject: Re: [Tutor] File IO At 01:34 PM 11/3/2005, Mi

Re: [Tutor] avoid eval how???

2005-11-03 Thread Liam Clarke-Hutchinson
Title: Message I recommend using pyparsing or similar parser to parse it; if merely to ensure that it's a valid algorithim.   Liam Clarke-Hutchinson| Contact Centre Advisor| Ministry of Economic Development DDI +64 3 962 2639 | Fax +64 3 962 6220www.med.govt.nz -Original Me

Re: [Tutor] avoid eval how???

2005-11-03 Thread Liam Clarke-Hutchinson
Title: Message Oops, I see I just doubled up on Danny's advice. Liam Clarke-Hutchinson| Contact Centre Advisor| Ministry of Economic Development DDI +64 3 962 2639 | Fax +64 3 962 6220www.med.govt.nz -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTE

Re: [Tutor] IRC Client Trouble -- too many new lines

2005-09-19 Thread Liam Clarke-Hutchinson
dMsg = nullString.join(msg) noNewlinesMsg = joinedMsg.replace('\n', nullString) Let me know how it goes. Regards, Liam Clarke-Hutchinson ________ From: Joseph Quigley [mailto:[EMAIL PROTECTED] Sent: Tuesday, 20 September 2005 2:19 a.m. To: Liam Clarke-Hutch

Re: [Tutor] Source PC MAC address

2005-08-25 Thread Liam Clarke-Hutchinson
>PS: do not forget to send your answers to Python Tutor also ... BTW, >could it be possible de configure the list so that the "reply-to" field >is set to the Python Tutor list instead of the sender ? I believe our list administrator has decided that reply-to munging can be considered harmful. h

Re: [Tutor] Using urllib to retrieve info

2005-08-08 Thread Liam Clarke-Hutchinson
;"" That's another caveat when using urllib. But yeah, digression aside, short answer is, I think your specified resource is dead, and a url-camper has taken all urls for that site and redirected them to a pop-up fest. Regards, Liam Clarke-Hutchinson -Original Mess