Re: [Tutor] Need help on Setup.py

2011-02-01 Thread Alan Gauld
Victor Binns vic_p...@hotmail.com wrote I have been trying to add some of the extras with python such as pywin32 and others. when i click on setup.py it does not work. I need help on the problem. It does not work is pretty vague, can you give more specifics? How are you running it? What

[Tutor] Formatting a string

2011-02-01 Thread Becky Mcquilling
Quick question to the group to solve an immediate problem and then if anyone has a dead simple reference on formatting strings it would be greatly appreciated as I'm finding this to be pretty confusing. Basically, I need to format a string as an example: He is {what}.format({wild}) I want to

Re: [Tutor] Need Help in installing MySQLdb-Python

2011-02-01 Thread Tommy Kaas
Fra: tutor-bounces+tommy.kaas=kaasogmulvad...@python.org [mailto:tutor-bounces+tommy.kaas=kaasogmulvad...@python.org] På vegne af Victor Binns Sendt: 1. februar 2011 01:19 Til: Tutor python Emne: [Tutor] Need Help in installing MySQLdb-Python I have Python 2.6.3 I went to the following

Re: [Tutor] Formatting a string

2011-02-01 Thread Karim
Hello, He is {what}.format(what={wild}) 'He is {wild}' Regards Karim On 02/01/2011 09:44 AM, Becky Mcquilling wrote: Quick question to the group to solve an immediate problem and then if anyone has a dead simple reference on formatting strings it would be greatly appreciated as I'm finding

Re: [Tutor] decimal module and precision

2011-02-01 Thread col speed
You can always change the precision in decimal. Just an idea On 31 January 2011 22:23, Richard D. Moores rdmoo...@gmail.com wrote: Which is accurate to only 16 digits; my Windows Vista calculator gives 2.9231329473018093516404474158812 for 23.45**.34 And using mpmath with Python 2.6

Re: [Tutor] Formatting a string

2011-02-01 Thread col speed
You're missing a . that if your computer is the same as mine, looks like something left behind by a mosquito On 1 February 2011 18:33, Karim karim.liat...@free.fr wrote: Hello, He is {what}.format(what={wild}) 'He is {wild}' Regards Karim On 02/01/2011 09:44 AM, Becky Mcquilling

Re: [Tutor] Formatting a string

2011-02-01 Thread Karim
Complete test copy paste: karim@Requiem4Dream:~$ python Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40) [GCC 4.4.3] on linux2 Type help, copyright, credits or license for more information. He is {what}.format(what={wild}) 'He is {wild}' I don't get the missing . ?! Regards Karim

Re: [Tutor] Need help on Setup.py

2011-02-01 Thread Walter Prins
Hi Victor, On 1 February 2011 07:38, Victor Binns vic_p...@hotmail.com wrote: I have been trying to add some of the extras with python such as pywin32 and others. when i click on setup.py it does not work. I need help on the problem. This is because setup.py is not intended to just be

Re: [Tutor] Formatting a string

2011-02-01 Thread Alan Gauld
Becky Mcquilling ladymcse2...@gmail.com wrote Basically, I need to format a string as an example: He is {what}.format({wild}) I want to insert wild in place of what and output the resulting text WITH the curly braces. what = 'wild' Here is {what}.format(what=what) 'Here is wild' Here

Re: [Tutor] Formatting a string

2011-02-01 Thread Becky Mcquilling
Thanks, as always. It all works. Becky On Tue, Feb 1, 2011 at 7:08 AM, Alan Gauld alan.ga...@btinternet.comwrote: Becky Mcquilling ladymcse2...@gmail.com wrote Basically, I need to format a string as an example: He is {what}.format({wild}) I want to insert wild in place of what and

[Tutor] tkinter nested class question

2011-02-01 Thread Elwin Estle
...at least I think it would be nested. Anyway, I have several widget groups that I want to create inside a frame, which is inside a class. I started to just do them with copying and pasting, and changing the values for each one (the first one is commented out, I left it in so you could see

[Tutor] Alternate button hit problem in tkinter

2011-02-01 Thread ANKUR AGGARWAL
Hey I am developing a zero-cross game from the basics of the tkinter. I want something like this- We have 4 buttons like 1 2 3 4 i want the output should change on the alternate button hit. Like inorder i hit- Button return 1 1 3 0 2 1 4 0

Re: [Tutor] Alternate button hit problem in tkinter

2011-02-01 Thread Wayne Werner
On Tue, Feb 1, 2011 at 3:24 PM, ANKUR AGGARWAL coolankur2...@gmail.comwrote: Hey I am developing a zero-cross game from the basics of the tkinter. I want something like this- We have 4 buttons like 1 2 3 4 i want the output should change on the alternate button hit. Like inorder i hit-

[Tutor] Composing lists from both items and other lists

2011-02-01 Thread John Simon
I'm looking for a way to flatten lists inside a list literal, kind of like this: start = '(' end = ')' items = ['abc', '+', 'def'] [start, *items, end] ['(', 'abc', '+', 'def', ')'] Of course, the star doesn't work there. Is there any easy, syntactically-lightweight way to get that output?

[Tutor] Help with range of months spanning across years

2011-02-01 Thread Sean Carolan
I have a function that accepts four arguments, namely startmonth, startyear, endmonth, and endyear. For example: startmonth = 8 startyear = 2009 endmonth = 1 endyear = 2010 What would be the most straightforward way to create a list of year/month pairs from start to end? I want to end up with

Re: [Tutor] Composing lists from both items and other lists

2011-02-01 Thread Corey Richardson
On 02/01/2011 03:40 PM, John Simon wrote: I'm looking for a way to flatten lists inside a list literal, kind of like this: start = '(' end = ')' items = ['abc', '+', 'def'] [start, *items, end] ['(', 'abc', '+', 'def', ')'] Of course, the star doesn't work there. Is there any easy,

Re: [Tutor] Composing lists from both items and other lists

2011-02-01 Thread Andre Engels
On Tue, Feb 1, 2011 at 9:40 PM, John Simon bigjohnexpr...@gmail.com wrote: I'm looking for a way to flatten lists inside a list literal, kind of like this: start = '(' end = ')' items = ['abc', '+', 'def'] [start, *items, end] ['(', 'abc', '+', 'def', ')'] Of course, the star doesn't work

Re: [Tutor] Composing lists from both items and other lists

2011-02-01 Thread Corey Richardson
On 02/01/2011 06:23 PM, Andre Engels wrote: On Tue, Feb 1, 2011 at 9:40 PM, John Simon bigjohnexpr...@gmail.com wrote: I'm looking for a way to flatten lists inside a list literal, kind of like this: start = '(' end = ')' items = ['abc', '+', 'def'] [start, *items, end] ['(', 'abc', '+',

Re: [Tutor] Help with range of months spanning across years

2011-02-01 Thread Hugo Arts
On Wed, Feb 2, 2011 at 12:19 AM, Sean Carolan scaro...@gmail.com wrote: I have a function that accepts four arguments, namely startmonth, startyear, endmonth, and endyear.  For example: startmonth = 8 startyear = 2009 endmonth = 1 endyear = 2010 What would be the most straightforward way

Re: [Tutor] Composing lists from both items and other lists

2011-02-01 Thread John Simon
Andre Engels andreengels at gmail.com writes Is: [start] + items + [end] lightweight enough? Oh man, duh. I knew it was something simple. Thanks :) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] tkinter nested class question

2011-02-01 Thread Alan Gauld
Elwin Estle chrysalis_reb...@yahoo.com wrote from Tkinter import * class Header_item(object): def __init__(self, lab_text = '', lab_width = 5, ent_width = 5, grid_row = 1, grid_col = 1): self.container = Frame() You haven't specified a parent object for the Frame. I suspect the

Re: [Tutor] Alternate button hit problem in tkinter

2011-02-01 Thread Alan Gauld
Wayne Werner waynejwer...@gmail.com wrote def one_or_zero(): x = 0 while True: x = not x yield x In case its not obvious how this iis used in a GUI context... So for your exampler crweate a state variable somewhere in your GUI (x in Waynes example) and toggle its value

Re: [Tutor] Help with range of months spanning across years

2011-02-01 Thread Alan Gauld
Hugo Arts hugo.yo...@gmail.com wrote What would be the most straightforward way to create a list of year/month pairs from start to end? I want to end up with a list of tuples like this: mylist = [(2009, 8), (2009, 9), (2009, 10), (2009, 11), (2009, 12), (2010, 1)] That said, you can do

Re: [Tutor] Help with range of months spanning across years

2011-02-01 Thread Elwin Estle
--- On Tue, 2/1/11, Sean Carolan scaro...@gmail.com wrote: From: Sean Carolan scaro...@gmail.com Subject: [Tutor] Help with range of months spanning across years To: Tutor@python.org Date: Tuesday, February 1, 2011, 6:19 PM I have a function that accepts four arguments, namely startmonth,

Re: [Tutor] Help with range of months spanning across years

2011-02-01 Thread ian douglas
It bugs me that so many people are quick to jump on the we wont' do your homework bandwagon -- I was accused of the same thing when I posted a question to the list myself. I've been programming professionally for many years but learning Python in my spare time... I sent this reply to Sean

Re: [Tutor] Help with range of months spanning across years

2011-02-01 Thread Sean Carolan
This sounds somewhat like homework. If it is, that's fine, mention it, and we will help you. But we won't do your homework for you, so keep that in mind. A reasonable assumption but this is actually going in a cgi tool that I'm using at work. The input comes from pull-down menus on a web

Re: [Tutor] Help with range of months spanning across years

2011-02-01 Thread Hugo Arts
On Wed, Feb 2, 2011 at 2:30 AM, ian douglas ian.doug...@iandouglas.com wrote: It bugs me that so many people are quick to jump on the we wont' do your homework bandwagon -- I was accused of the same thing when I posted a question to the list myself. I've been programming professionally for many

Re: [Tutor] Help with range of months spanning across years

2011-02-01 Thread Hugo Arts
On Wed, Feb 2, 2011 at 2:55 AM, Sean Carolan scaro...@gmail.com wrote: This sounds somewhat like homework. If it is, that's fine, mention it, and we will help you. But we won't do your homework for you, so keep that in mind. A reasonable assumption but this is actually going in a cgi tool

Re: [Tutor] Help with range of months spanning across years

2011-02-01 Thread Sean Carolan
As far as I can tell from quickly going through documentation, no. At least, not with a quick and easy function. datetime can represent the dates just fine, and you can add days to that until you hit your end date, but adding months is harder. timedelta can't represent a month, which makes

Re: [Tutor] decimal module and precision

2011-02-01 Thread Richard D. Moores
On Tue, Feb 1, 2011 at 04:29, col speed ajarnco...@gmail.com wrote: You can always change the precision in decimal. Just an idea Not exactly sure what you mean. But I just tried using decimal to get 123.2345274523452345235432452345 ** 2.3 to 300 digits: from decimal import Decimal as D