Re: [Tutor] Rock, Paper, Scissors

2006-08-07 Thread Jordan Greenberg
Christopher Spears wrote: > This looks like a fun project to work on. From > reading the description, I feel this would be pretty > straight forward game to program. However, I have no > idea how the computer would decide if it wanted a > rock, paper, or a pair of scissors. Any hints? Since t

Re: [Tutor] Rock, Paper, Scissors

2006-08-07 Thread John Fouhy
On 08/08/06, Christopher Spears <[EMAIL PROTECTED]> wrote: > This looks like a fun project to work on. From > reading the description, I feel this would be pretty > straight forward game to program. However, I have no > idea how the computer would decide if it wanted a > rock, paper, or a pair of

[Tutor] Rock, Paper, Scissors

2006-08-07 Thread Christopher Spears
I have been looking for a new project to tackle when I came across this link: http://www.ibiblio.org/obp/pyBiblio/practice/wilson/rockpaperscissors.php. Here is some sample output that was provided at the webpage: Welcome to Rock, Paper, Scissors! How many points are required for a win? 3 Choos

Re: [Tutor] help regarding forms... (fwd)

2006-08-07 Thread Brian van den Broek
Alan Gauld said unto the world upon 07/08/06 04:43 PM: >> this list is setup to send to the poster by default. I made the >> mistake of doing such a thing earlier myself. >> I know this is a huge item of contention, but do people favor having >> the default be to send replies to the list? > > OK,

[Tutor] sending emails with html attachment

2006-08-07 Thread anil maran
hi guysWhat is the best way to construct an email in python and also attach a html filethe file is not on disk, but should be dynamically constructed in the python scriptthanks a lot __Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protec

Re: [Tutor] true and false

2006-08-07 Thread Bob Gailer
Alan Gauld wrote: >> What values represent true in Python? >> > > True > > Its a built-in boolean type value. > > But empty strings, lists, tuples etc are considered False > Similarly zero and None are considered False > Let us be precise here. Empty things are considered False when used w

Re: [Tutor] help regarding forms... (fwd)

2006-08-07 Thread Danny Yoo
> this list is setup to send to the poster by default. I made the > mistake of doing such a thing earlier myself. Hi Terrence, Most email clients have a separate "Reply to All" or "Reply to group" command that's suitable for mailing lists. Check to see if your mail client has this feature. >

Re: [Tutor] creating a method name on the fly

2006-08-07 Thread John Fouhy
On 08/08/06, wesley chun <[EMAIL PROTECTED]> wrote: > import Tkinter > > root = Tkinter.Tk() > MyButton = partial(Tkinter.Button, root, fg='white', bg='blue') > b1 = MyButton(text='Button 1') > b2 = MyButton(text='Button 2') > qb = MyButton(text='QUIT', bg='red', command=root.quit) > > "MyButton" c

Re: [Tutor] Community documentation framework?

2006-08-07 Thread Henry Finucane
On 8/6/06, Bob Nienhuis <[EMAIL PROTECTED]> wrote: > > Have you had the experience of finding a nifty bit of code on the > web, trying it out, and then discovering that technique > only worked in version X.YY, or requires module Z that > is no longer available? > > Well perhaps we can address

Re: [Tutor] creating a method name on the fly

2006-08-07 Thread wesley chun
> Also you can put more information in your data structure if you want > (eg, information on placing the button, styles for the button, etc). > And, if you need to save the Button objects themselves, you could add > them to a dict in the body of the loop: > > self.buttons = {} > for label, callback

Re: [Tutor] creating a method name on the fly

2006-08-07 Thread John Fouhy
On 08/08/06, Alan Gauld <[EMAIL PROTECTED]> wrote: > Why not just add the buttons to a list as you create them then > iterate over the list? Or better still use a dictionary with the name > as key. You can do nice things with tuples. A simple example would be: # (label, callback) buttons = [('OK

Re: [Tutor] true and false

2006-08-07 Thread Alan Gauld
> What values represent true in Python? True Its a built-in boolean type value. But empty strings, lists, tuples etc are considered False Similarly zero and None are considered False The library reference has a full list somewhere, but it's pretty much what intuition would tell you. "Empty" t

Re: [Tutor] Invoking bash from python

2006-08-07 Thread Alan Gauld
>I was thinking that Python would have an expect-like clone and they >do: > http://pexpect.sourceforge.net/ > > Don't know how good it is though. Pretty reasonable, its been around for a while. But if you know the order of requests expect is overkill. Expect is really for those situations where

Re: [Tutor] Beginner's question

2006-08-07 Thread Alan Gauld
> but did not give importance to it. I am hearing a lot about Python > again recently. I was wondering what Python is good for and how will > it help me, since I am already comfortable with C. One line of Python ~= 10 lines of C So in terms of delivering results quickly Python is much faster than

Re: [Tutor] help regarding forms... (fwd)

2006-08-07 Thread Alan Gauld
> this list is setup to send to the poster by default. I made the > mistake of doing such a thing earlier myself. > I know this is a huge item of contention, but do people favor having > the default be to send replies to the list? OK, I've got to ask. This comes up every so often and I really don'

Re: [Tutor] creating a method name on the fly

2006-08-07 Thread Alan Gauld
>I need to scan a long list of QT tickboxes in a dialog. I need to >execute > pseudo code something like ... > > list = ['error_button', 'print_button' ... etc ] > for key in list: > button= list[key] > print button, self.button.isChecked() > > > where self.button.isChecked() becomes self.error

Re: [Tutor] os.system() with NO_WAIT

2006-08-07 Thread wesley chun
> os.system('vedicom.exe') > > Have you got any idea how I can strart this windows GUI program with not > waiting its return. instead of os.system(), you want to use the subprocess module if you are using Python 2.4+: http://docs.python.org/lib/module-subprocess.html calling subprocess.Po

Re: [Tutor] creating a method name on the fly

2006-08-07 Thread dave s
Thanks for all your input - the discussion wandered off list a bit ! This solution works a treat ... button= getattr(self, 'error_button') print button, button.isChecked() Cheers Dave ___ Tutor maillist - Tutor@python.org http://mail.python.org/mail

Re: [Tutor] creating a method name on the fly

2006-08-07 Thread wesley chun
> > list = ['error_button', 'print_button' ... etc ] > > for key in list: > > button= list[key] > > print button, self.button.isChecked() > > > list = ['error_button', 'print_button' ... etc ] > for key in list: >

Re: [Tutor] Beginner's question

2006-08-07 Thread wesley chun
hi mahesh, welcome to python... once you're here, there is no turning back. :-) > I am hearing a lot about Python > again recently. please tell us how and where you are hearing about Python now... the community is always interested in hearing interesting stories, such as Terrence's. > I was wo

Re: [Tutor] true and false

2006-08-07 Thread wesley chun
> What values represent true in Python? good question. let's look at it from the other way as it's easier: a Boolean False value is any zero or empty container while True is anything *other* than those values. at the risk of plagarizing myself, here is a clip from chapter 4 of "Core Python:" C

[Tutor] true and false

2006-08-07 Thread Terrence Brannon
What values represent true in Python? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Invoking bash from python

2006-08-07 Thread Terrence Brannon
I was thinking that Python would have an expect-like clone and they do:http://pexpect.sourceforge.net/Don't know how good it is though. On 8/7/06, Alan Gauld <[EMAIL PROTECTED]> wrote: >I think I found a solution to my problem and thats to use the os>module (> os.system function). I'm still open to

Re: [Tutor] Beginner's question

2006-08-07 Thread Terrence Brannon
On 8/7/06, Mahesh <[EMAIL PROTECTED]> wrote: Hi All,Hi Mahesh  To start with, please forgive me if this question is already answered.I am totally new to Python. I heard about Python some 3 years back,but did not give importance to it.Similar to my story. I have been a 100% Perl professional for 6 y

Re: [Tutor] help regarding forms... (fwd)

2006-08-07 Thread Luke Paireepinart
Terrence Brannon wrote: > > > On 8/7/06, *Danny Yoo* <[EMAIL PROTECTED] > > wrote: > > > Hi Anil, > > Please do not email me directly. > > > this list is setup to send to the poster by default. I made the mistake of > doing such a thing earlier myself. > I kno

Re: [Tutor] Invoking bash from python

2006-08-07 Thread Alan Gauld
>I think I found a solution to my problem and thats to use the os >module ( > os.system function). I'm still open to any suggestions you may have. os system() will just run the bash program. Not too much avanytage. If you want to control the program from Python you need the popen functions - or t

Re: [Tutor] Invoking bash from python

2006-08-07 Thread Alan Gauld
> required. So far, I've figured out that I can use urllib to fetch > the file > and the commands module to execute some system commands. > Any ideas on how Ican envoke bash and pass on the users input to > bash. Look at the Subprocess module and the Popen class. Check the examples of how tyo s

[Tutor] Beginner's question

2006-08-07 Thread Mahesh
Hi All, To start with, please forgive me if this question is already answered. I am totally new to Python. I heard about Python some 3 years back, but did not give importance to it. I am hearing a lot about Python again recently. I was wondering what Python is good for and how will it help me, sin

Re: [Tutor] creating a method name on the fly

2006-08-07 Thread Python
On Mon, 2006-08-07 at 18:10 +, dave s wrote: > I need to scan a long list of QT tickboxes in a dialog. I need to execute > pseudo code something like ... > > > list = ['error_button', 'print_button' ... etc ] > for key in list: > button= l

Re: [Tutor] help regarding forms... (fwd)

2006-08-07 Thread Terrence Brannon
On 8/7/06, Danny Yoo <[EMAIL PROTECTED]> wrote: Hi Anil,Please do not email me directly.  this list is setup to send to the poster by default. I made the mistake of doing such a thing earlier myself. I know this is a huge item of contention, but do people favor having the default be to send replies

Re: [Tutor] can you explain string replacement syntax and comma separated statements (fwd)

2006-08-07 Thread Danny Yoo
> The help page doesnt take about multiline string replacement and this > example doesnt work for me Hi Anil, Please be more specific and as informative as you can; we can't look over your shoulder, and the only information we see is what you send us. When you say, "This example doesn't work

Re: [Tutor] help regarding forms... (fwd)

2006-08-07 Thread Danny Yoo
> can you explain post methods and actions i wasnt able to find out how it > works Hi Anil, Please do not email me directly. I don't have much time these days to help on Tutor. It is better to send replies back to the Tutor list, so that others there can continue helping you. Also, apologie

[Tutor] creating a method name on the fly

2006-08-07 Thread dave s
I need to scan a long list of QT tickboxes in a dialog. I need to execute pseudo code something like ... list = ['error_button', 'print_button' ... etc ] for key in list: button= list[key] print button, self.butto

Re: [Tutor] quick OO pointer

2006-08-07 Thread Alan Gauld
> If my script that needs to call a function from another module, and > the > module itself both require, say, the string module do i need to > import > it in both? Yes, importing just makes the name visible in the module where it is imported. So if you import your module the stuff that it

Re: [Tutor] can you explain string replacement syntax and comma separated statements (fwd)

2006-08-07 Thread Danny Yoo
-- Forwarded message -- Date: Mon, 7 Aug 2006 00:33:08 -0700 (PDT) From: anil maran <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] can you explain string replacement syntax and comma separated statements Dear danny yoo The help page doesnt take ab

Re: [Tutor] help regarding forms... (fwd)

2006-08-07 Thread Danny Yoo
-- Forwarded message -- Date: Mon, 7 Aug 2006 00:28:50 -0700 (PDT) From: anil maran <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] help regarding forms... dear danny yoo thanks a lot for replying can you explain post methods and actions i wasnt able to

Re: [Tutor] quick OO pointer

2006-08-07 Thread shawn bright
Way cool, thanks a lot. I have one more small question.If my script that needs to call a function from another module, and the module itself both require, say, the string module do i need to import it in both?If i just import string on my original script, will the module know what to do with it

Re: [Tutor] quick OO pointer

2006-08-07 Thread Alan Gauld
> now, i have a few functions in some scripts that i would like to > reuse > across the board. But, they dont really fit the "object" thing, i > dont > thing. Basically, i have a bunch of functions that do different > things and i > would like one script to hold them all. You can put normal fun

Re: [Tutor] Invoking bash from python

2006-08-07 Thread William Mhlanga
I think I found a solution to my problem and thats to use the os module (os.system function). I'm still open to any suggestions you may have.--WillOn 8/7/06, William Mhlanga <[EMAIL PROTECTED]> wrote: I'd like to write an app that helps a user install a program on Linux after fetching it from a re

[Tutor] Invoking bash from python

2006-08-07 Thread William Mhlanga
I'd like to write an app that helps a user install a program on Linux after fetching it from a remote site. The program is packaged as a bin file and when run from bash, the user has to agree to a licence agreement by entering "y" or "n" and enter a path for installation. It seems like I need to fi

[Tutor] os.system() with NO_WAIT

2006-08-07 Thread János Juhász
Dear Guys, I have a small script that is running on a terminal server's client session. ### import os import time import glob def send():     print 'I am checking %s' % time.ctime()     if len(glob.glob(r'U:\ediout\DESADV\*.doc')) > 0:         os.system('vedicom.exe') if __name__ == '__mai

Re: [Tutor] quick OO pointer

2006-08-07 Thread Jordan Greenberg
shawn bright wrote: > Hello there, > > a while back i wrote a module called DbConnector.py that allowed me to run > different types of SQL queries. Cool enough. > i did it mostly to handle the open and close of a db connection so i > wouldn't have to worry about 'too many connection' errors. > it