Re: [Tutor] Getting "file sizes" (fwd) [oops, old message!]

2005-03-24 Thread Danny Yoo
Hi everyone, My apologies about the repeated message; I just got an old message from last year, and didn't look closely enough to see that it was a repeat from last year! The mail queue of some folks is really ancient; I wonder why that bounced to me today. Odd. Anyway, sorry about that!

Re: [Tutor] Trying to use MySQLdb.cursor

2005-03-24 Thread Danny Yoo
On Fri, 25 Mar 2005, Vicki Stanfield wrote: > I finally gave up and used MySQLdb to connect to my database. It > connects okay, and returns data, but now I have a new question. I use > the code below to print the data returned from my query, but I would > like to make labels at the top of the co

Re: [Tutor] Getting "file sizes" (fwd)

2005-03-24 Thread Danny Yoo
-- Forwarded message -- Date: Wed, 18 Feb 2004 16:44:49 -0800 From: Joshua Banks <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Cc: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Getting "file sizes" On Wednesday 18 February 2004 01:22 pm, you wrote: > Ah, a Gentoo fan. *grin* Y

[Tutor] Trying to use MySQLdb.cursor

2005-03-24 Thread Vicki Stanfield
I finally gave up and used MySQLdb to connect to my database. It connects okay, and returns data, but now I have a new question. I use the code below to print the data returned from my query, but I would like to make labels at the top of the columns. How do I do this dynamically? I would like to ge

Re: [Tutor] Changing a class into a subclass

2005-03-24 Thread Kent Johnson
Ismael Garrido wrote: But there's something that I couldn't understand. In the following code, my guess would be that "I'm back from the death" would never get printed... but it is... and twice! Why? It's printed every time B.pong() is called, just as "Pong" is. You print each one twice - no mys

Re: [Tutor] Changing a class into a subclass

2005-03-24 Thread Ismael Garrido
Alan Gauld wrote: Absolutely, looks like you answered your own question... :-) But if you want an OOP approach thre are some things to try. First you can create a BuildingFactory class that has a single instance (or indeed no instances because you could use a static method... or get really fancy an

[Tutor] Re: xmlrpc server

2005-03-24 Thread Andrei
Luis N wrote on Thu, 24 Mar 2005 05:31:03 +0200: > py-xmlrpc uses a scant 4mb of memory, does only one thing, and does it > well, serve xmlrpc requests. It appears significantly faster than > Twisted. > > SimpleXMLRPCServer, as a CGI solution, appears acceptable, given that > it be run from Fas

Re: [Tutor] Defining functions

2005-03-24 Thread Kent Johnson
John Carmona wrote: Hi there, I have written (well almost as I copied some lines from an existing example) this little programme - part of an exercise. def print_options(): print "--" print "Options:" print "1. print options" print "2. calcu

Re: [Tutor] Defining functions

2005-03-24 Thread Michael Dunn
Hi John, when you want user input, you almost always need raw_input(), not input(). Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

RE: [Tutor] Defining functions

2005-03-24 Thread Ryan Davis
Did you put them in quotes? # If choice == 'c': ... # Thanks, Ryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Carmona Sent: Thursday, March 24, 2005 5:52 PM To: tutor@python.org Subject: [Tutor] Defining functions Hi there, I have written

[Tutor] Defining functions

2005-03-24 Thread John Carmona
Hi there, I have written (well almost as I copied some lines from an existing example) this little programme - part of an exercise. #By J Carmona #Programme that compute area for #circle, square, rectangle def area_rect(): length = input("Length: ") width = input ("Width: ")

Re: [Tutor] Changing a class into a subclass

2005-03-24 Thread Kent Johnson
Alan Gauld wrote: But if you want an OOP approach thre are some things to try. First you can create a BuildingFactory class that has a single instance (or indeed no instances because you could use a static method... or get really fancy and create a meta-class!). or make it a static method of Build

Re: [Tutor] Changing a class into a subclass

2005-03-24 Thread Alan Gauld
> Are you referring to a Python object? If so you may assign a class to the > object's __class__ attribute. > class A:pass > class B:pass > b = b() > print b.__class__ # displays > b.__class__ = A > print b.__class__ # displays Interesting Bob, but presumably that doesn't change the internal sta

Re: [Tutor] Changing a class into a subclass

2005-03-24 Thread Alan Gauld
> > let itself load. Now, with subclasses, if I send the House XML to > > Building I get a Building instance, when I need a House instance. > > You can't make an object transform into an object of a different > class. You need to identify what class the object will be an instance > of before loadin

Re: [Tutor] Tkinter and keyboard output

2005-03-24 Thread Alan Gauld
> What if instead of coding , I coded - how would > I implement the function which would allow the code to determine > which 'Key' was pressed after Alt? There is probably a more correct way of doing it but I'd simply write a small test application that printed out the key values, then type in t

Re: [Tutor] I need some guidance

2005-03-24 Thread Alan Gauld
> Alan, I am a bit lost when you wrote: > " > Read a lot and experiment a lot. Thats where Pythons >>> prompt really > helps. You can build quite sophisticated programs very quickly > by the way Windows XP and the Python v2.4). Do you mean writing from the > Command Line windows instead to use the

Re: [Tutor] Changing a class into a subclass

2005-03-24 Thread Bob Gailer
At 10:30 AM 3/24/2005, Max Noel wrote: On Mar 24, 2005, at 18:07, Ismael Garrido wrote: Hello. I have a program that saves/loads to/from XML. I have a main class Building, and a subclass House(Building). When I save the code I instruct each object to save itself to XML (using ElementTree), so Hou

Re: [Tutor] Changing a class into a subclass

2005-03-24 Thread Kent Johnson
Max Noel wrote: On Mar 24, 2005, at 18:07, Ismael Garrido wrote: Hello. I have a program that saves/loads to/from XML. I have a main class Building, and a subclass House(Building). When I save the code I instruct each object to save itself to XML (using ElementTree), so House adds itself to the

Re: [Tutor] Changing a class into a subclass

2005-03-24 Thread Max Noel
On Mar 24, 2005, at 18:07, Ismael Garrido wrote: Hello. I have a program that saves/loads to/from XML. I have a main class Building, and a subclass House(Building). When I save the code I instruct each object to save itself to XML (using ElementTree), so House adds itself to the XML tree. My pro

[Tutor] re question

2005-03-24 Thread Ertl, John
All I have a string that has a bunch of numbers with the units attached to them. I want to strip off the units. I am using a regular expression and sub to do this. This works great for almost all of the cases. These are the type of lines: SigWind: 857hPa, , 21.0C, 20.1C, 210 @ 9

[Tutor] Tkinter and keyboard output

2005-03-24 Thread Igor Riabtchuk
Hi,   I was playing around with Tkinter bindings and I got a question which is probably not particularly bright.   If I have the following code, it works because I specifically code a function for keypress:   from Tkinter import *class CRED(Frame):    def __init__(self):    Frame.__i

[Tutor] Changing a class into a subclass

2005-03-24 Thread Ismael Garrido
Hello. I have a program that saves/loads to/from XML. I have a main class Building, and a subclass House(Building). When I save the code I instruct each object to save itself to XML (using ElementTree), so House adds itself to the XML tree. My problem is when I load the XML. Before having subcla

Re: [Tutor] I need some guidance

2005-03-24 Thread John Carmona
Thanks everybody for their input. It is great to know that there are some people ready to help. Ara Kooser, what I meant by this "science", I have meant programming, sorry if I was not too clear. Alan, I will check those programming contests you were talking about, but only when I will feel re

[Tutor] Mysqldb module - where ?????

2005-03-24 Thread Vicki Stanfield
I am googling for a slackware package containing the Mysqldb module, but all I am coming up with is MySQLdb. I am not hallucinating right? They are indeed two separate modules? Vicki ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman

Re: [Tutor] blocking user access

2005-03-24 Thread Kent Johnson
Diana Hawksworth wrote: Liam, I am using IDLE - and Tkinter, John and Liam. I have been working through the book "Python Programming" by Michael Dawson. One of his programs calls for the entry of a password, then reveals a message. What I would like to do is make the Text widget that reveals the

Re: [Tutor] List comprehensions

2005-03-24 Thread Karl Pflästerer
On 23 Mrz 2005, [EMAIL PROTECTED] wrote: > map is (probably) going to be removed in Python3000 :-( So it's > probably better to not get into the habit of using it. Au contraire. If enough people use it and are used using it the risk for `map' getting removed will be a lot lower. Furthermore t

Re: [Tutor] blocking user access

2005-03-24 Thread Diana Hawksworth
Liam, I am using IDLE - and Tkinter, John and Liam. I have been working through the book "Python Programming" by Michael Dawson. One of his programs calls for the entry of a password, then reveals a message. What I would like to do is make the Text widget that reveals the message, unusable by a u

Re: [Tutor] I need some guidance

2005-03-24 Thread Alan Gauld
> Hi to everyone first, this is my first posting and I hope that I won't make > a mess. Hello and welcome. > I have started by reading the excellent "Non-ProgrammersTutorial For Python" > by Josh Cogliati. I like it a lot. It's a fine intro to Python and programming. > My first question is do

Re: [Tutor] Dictionary blues...

2005-03-24 Thread Alan Gauld
> >if D.has_key(event.keysym): > > str=D[event.keysym] > >self.text.insert(END,str) > > You can remove the 'text.' thats only used if text > were part of a class, which in this case it isn't. Oops, that should say remove 'self.' not text. Alan G. ___