[Tutor] Seeking PYTHON Mentor

2005-11-12 Thread mike donato
Greetings, I am an Information Technology student and am seeking a mentor for the Python Language. Primarily my areas of specialization have been Local Area Network and PC Tech Support however have a data structure class as a degree requirement. The class is in Python. I have downloaded python

[Tutor] problem calling a function

2005-11-12 Thread Vincent Wan
Dear all, I have a simple program that calls a function I got off of active state that draws a tree given a description of it in standard string form. My code generates a string description and calls the function to draw the tree. Instead of drawing the tree it echos the string. But when I ca

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

2005-11-12 Thread Kent Johnson
Tim Johnson wrote: > I need to get up to speed on iterators. I learned python 1.5~ via > Alan G's book ... > For an example, I've written a subclass of dict where keys are kept in > a ordered fashion is a list called __keys: > > #Here is my items function: > def items(self): > """ Return a

Re: [Tutor] Can I use TKInter and Pygame together?

2005-11-12 Thread Danny Yoo
On Sat, 12 Nov 2005, Nathan Pinno wrote: > Can I use Pygame and TKInter together in the same application? I want to > use TKInter for the message boxes, and Pygame for the actual game > interface, but is this possible? Hi Nathan, Yes; here's a link to an example that combines both Tkinter and

Re: [Tutor] output question

2005-11-12 Thread Shi Mu
On 11/12/05, Danny Yoo <[EMAIL PROTECTED]> wrote: > > > > from the code: > > > > try: > > > > fsock = open("c:/TEMP/hello.txt") > > > > except IOError: > > > > print "The file does not exist, exiting gracefully" > > > > print "Yes!!! This line will always print" > > > I thought if the excep

Re: [Tutor] output question

2005-11-12 Thread Danny Yoo
> > > from the code: > > > try: > > > fsock = open("c:/TEMP/hello.txt") > > > except IOError: > > > print "The file does not exist, exiting gracefully" > > > print "Yes!!! This line will always print" > I thought if the except situation does not happen, that means the try > section works.

Re: [Tutor] output question

2005-11-12 Thread Shi Mu
On 11/12/05, Danny Yoo <[EMAIL PROTECTED]> wrote: > > > So, you're successfull opening a file. Now, you need to read it > > > > > > for line in fsock: > > >print line > > > > > > Have a play with those. > > it works! thanks! > > > Hi Shi Mu, > > Ok, but let's go back to your original question n

[Tutor] Using CGIHTTPServer on Windows to run Perl & Python scripts - POST to Perl fails

2005-11-12 Thread Python
I should have included the REQUEST_METHOD before. Yes it is correct. This is a useful test perl script I downloaded from a Perl oriented site: > #!/usr/bin/perl use CGI; $cgi = new CGI; for $key ( $cgi->param() ) { $input{$key} = $cgi->param($key); } pri

Re: [Tutor] console text positioning

2005-11-12 Thread Chris F.A. Johnson
On Sat, 12 Nov 2005, Bojan Raicevic wrote: > I'm not sure how explain my problem, but I'll try. > > I want to make something that looks like console quiz. > So it would look somehow like this: > > print "Question one (a,b,c,d): " > #user should answer with a,b,c or d - anything else > inputed shou

Re: [Tutor] console text positioning

2005-11-12 Thread Alan Gauld
> problem** I DON'T want to see in console output > repeated questions like: > > Question one (a,b,c,d): ftbryj > Question one (a,b,c,d): asdf > Question one (a,b,c,d): a > Question two (1,2,3,4): b > Question two (1,2,3,4): 5 > Question two (1,2,3,4): 2 > Question three (a,b,c): > ... > > I wan

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

2005-11-12 Thread Alan Gauld
>I need to get up to speed on iterators. I learned python 1.5~ via > Alan G's book ... Yeah, me too! iterators are one of the newer features of Python that I use but haven't really played with in depth. But I guess I really should get down to it and add a section to my tutor covering both iter

Re: [Tutor] Windows IDLE error msgs?

2005-11-12 Thread Alan Gauld
Are you sure you don't get an error? I get a dialog box that pops up containing exactly the same error message you get from the console. Alan G. - Original Message - From: "CPIM Ronin" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, November 12, 2005 9:00 PM Subject: Re: [Tut

[Tutor] console text positioning

2005-11-12 Thread Bojan Raicevic
I'm not sure how explain my problem, but I'll try. I want to make something that looks like console quiz. So it would look somehow like this: print "Question one (a,b,c,d): " #user should answer with a,b,c or d - anything else inputed should result without reaction - **my problem** I DON'T want t

Re: [Tutor] Can I use TKInter and Pygame together?

2005-11-12 Thread Kent Johnson
Nathan Pinno wrote: > Hey all, > > Can I use Pygame and TKInter together in the same application? I want to > use TKInter for the message boxes, and Pygame for the actual game > interface, but is this possible? The 'slides' application from this page http://www.pygame.org/gamelets/ and this th

[Tutor] iteritems() vs items()

2005-11-12 Thread Tim Johnson
I need to get up to speed on iterators. I learned python 1.5~ via Alan G's book ... For an example, I've written a subclass of dict where keys are kept in a ordered fashion is a list called __keys: #Here is my items function: def items(self): """ Return all pairs in order of addition"""

Re: [Tutor] Windows IDLE error msgs?

2005-11-12 Thread Kent Johnson
CPIM Ronin wrote: > I can get the standard Python error messages IF I execute a Python > script via the command line OR the script I'm running from IDLE passes > the initial syntax check and generates an execution error. However, if I > have a syntax error that's caught in the initial syntax che

Re: [Tutor] calculus in python

2005-11-12 Thread Danny Yoo
> do you know any module can calculate numeric integral and analytic > derivative of n-dimension function? Hi Mohammad, Your question is on a specialized math topic; we at Tutor probably won't be able to help you well. You might want to check with the Scientific Python folks instead: http:

[Tutor] Can I use TKInter and Pygame together?

2005-11-12 Thread Nathan Pinno
Hey all,   Can I use Pygame and TKInter together in the same application? I want to use TKInter for the message boxes, and Pygame for the actual game interface, but is this possible?   Nathan Pinno ___ Tutor maillist - Tutor@python.org http://mail.

Re: [Tutor] output question

2005-11-12 Thread Danny Yoo
> > So, you're successfull opening a file. Now, you need to read it > > > > for line in fsock: > >print line > > > > Have a play with those. > it works! thanks! Hi Shi Mu, Ok, but let's go back to your original question now, just to make sure we've learned something. You asked earlier: >

Re: [Tutor] How do I make a text box pop up in a GUI before the mainpart of the program loads?

2005-11-12 Thread Nathan Pinno
Actually, I'm going to be using Pygame. I need to know, because I want to pop up a polite explanation of how to play the game and a reminder. Nathan Pinno - Original Message - From: Alan Gauld To: Nathan Pinno ; tutor@python.org Sent: November 12, 2005 10:47 AM Subject: R

Re: [Tutor] How do I make a text box pop up in a GUI before the mainpart of the program loads?

2005-11-12 Thread Alan Gauld
> How do I make a text box pop up in a GUI before the main part of the > program > loads? Do you mean like a splash screen? If you are using Tkinter you can use a TopLevel widget to create and display the splash screen before you pack the main application window. If its only a simple message bo

Re: [Tutor] Windows IDLE error msgs?

2005-11-12 Thread Alan Gauld
> syntax check and generates an execution error. However, if I have a syntax > error that's caught in the initial syntax checking phase, IDLE merely goes > to the particular line and highlights the line where the error was > detected. Can you be more specific? Maybe include some short code that

Re: [Tutor] logging to a database

2005-11-12 Thread captnswing
thanks kent, I actually got it working! -frank On 11 nov 2005, at 12.26, Kent Johnson wrote: > captnswing wrote: >> Hello all, >> I would like to log messages to a database (mysql) >> I found the example log_test14.py that comes with python logging >> module http://www.red-dove.com/python_logging

[Tutor] ftp transfer - queue & retry pattern

2005-11-12 Thread captnswing
Hello, I want to write a module that transfers a given file to a given destination with a given protocol (ftp, sftp, scp) to start out, just ftp would be sufficient the destination machines are sometimes unavailable, or the transfer fails sometimes due to connection problems I have several que

[Tutor] How do I make a text box pop up in a GUI before the main part of the program loads?

2005-11-12 Thread Nathan Pinno
Hey all,   How do I make a text box pop up in a GUI before the main part of the program loads?   Thanks, Nathan Pinno, Owner/operator of The Web Surfer's Store. http://www.the-web-surfers-store.com/   BEGIN:VCARD VERSION:2.1 N:Pinno;Nathan;Paul;Mr. FN:Pinno, Nathan Paul ORG:Zoffee;Executiv

[Tutor] calculus in python

2005-11-12 Thread Mohammad Moghimi
Hi do you know any module can calculate numeric integral and analytic derivative of n-dimension function?-- -- Mohammaddo you Python?!! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Windows IDLE error msgs?

2005-11-12 Thread CPIM Ronin
I can get the standard Python error messages IF I execute a Python script via the command line OR the script I'm running from IDLE passes the initial syntax check and generates an execution error. However, if I have a syntax error that's caught in the initial syntax checking phase, IDLE merely g

Re: [Tutor] Using CGIHTTPServer on Windows to run Perl & Python scripts - POST to Perl fails

2005-11-12 Thread Christopher Arndt
Python schrieb: > The Python scripts are OK. The Perl scripts do not receive the POST > parameters so they execute as though no parameters were supplied. I've > added logic to display the environment and that appears (to my Python > oriented eye) to be correct. In particular, the CONTENT_LENGTH

Re: [Tutor] output question

2005-11-12 Thread Alan Gauld
>fsock = open("c:/TEMP/hello.txt") This opens the file ready for you to read it. Thats all. You need to tell Python what you want to do with the file now that you've opened it. > why it does not show on the output. To display the contents you need print fsock.read() Have a look at the Han

Re: [Tutor] File extension for CGI scripts written in Python

2005-11-12 Thread Alan Gauld
> Python. In the literature I have studied, I have seen the extensions .cgi > and .py applied to such files. Is one preferred over the other, or is it > a > matter of personal preference? It depends on how your web server hsa been set up, there are two basic options: 1) All CGUI scripts go in

Re: [Tutor] output question

2005-11-12 Thread Shi Mu
On 11/12/05, Liam Clarke <[EMAIL PROTECTED]> wrote: > Sorry Shi Mu, don't understand the question. > > So, you're successfull opening a file. Now, you need to read it > > for line in fsock: >print line > > or > > fsockData = fsock.read() > > or > > nextLine = fsock.readline() > > Have a play wi

Re: [Tutor] output question

2005-11-12 Thread Liam Clarke
Sorry Shi Mu, don't understand the question. So, you're successfull opening a file. Now, you need to read it for line in fsock: print line or fsockData = fsock.read() or nextLine = fsock.readline() Have a play with those. On 11/12/05, Shi Mu <[EMAIL PROTECTED]> wrote: > I got the output

[Tutor] output question

2005-11-12 Thread Shi Mu
I got the output as: >>> Yes!!! This line will always print from the code: try: fsock = open("c:/TEMP/hello.txt") except IOError: print "The file does not exist, exiting gracefully" print "Yes!!! This line will always print" it means the code found there is hello.txt, why it does not show