Re: [Tutor] GUI Buttons

2009-10-14 Thread Albert-Jan Roskam
Hi Alan and Kent, Thank you for helping me. This is a lot simpler than the solution I had in mind. The button names in my program always start with "button_", so I wanted to use locals() in a list comprehension to compile a list of the buttons. But then I'd still have the names and not the inst

Re: [Tutor] GUI Buttons

2009-10-14 Thread ALAN GAULD
> But when is the configure() method more appropriate to change e.g. the button > status? configure is better when you need to change more than one attribute of a widget at a time. The dictionary style access is just a convenience feature. If you prefer you can use configure() all the time.

Re: [Tutor] writing sample program that zips files and saves in a backup directory

2009-10-14 Thread David
David Eric wrote: On Tue, Oct 13, 2009 at 5:17 PM, Kent Johnson > wrote: On Tue, Oct 13, 2009 at 4:38 PM, David Eric mailto:cii...@gmail.com>> wrote: > as far as print zip_command, i would add that to the program however, doesnt > just declaring it ac

Re: [Tutor] Switching to other version of Python

2009-10-14 Thread Lie Ryan
Alan Gauld wrote: > > "Corey Richardson" wrote >> My school has python 2.4. I have python 2.6, and I find it perfectly >> wonderful. However, I am contemplating the switch, and am wondering, >> what is your personal opinion on why or why not to use 3.x? Thanks for >> the help in advance, > > Wel

Re: [Tutor] Recursive user input collection problem

2009-10-14 Thread Lie Ryan
William Witteman wrote: > I need to collect a couple of integers from a user, but I want to make > sure that I actually get integers. I tried this, but subsequent calls > to the function don't update variable. I'm not sure this is terribly > clear - here's the code: > > > def getinput(variable,

[Tutor] namespaces and global

2009-10-14 Thread Jose Amoreira
Hello I'm new to this list. I tried to find the answer to my question but found nothing I could really use. I'm sorry if this is a FAQ. I want to use a variable defined in an interactive session with the python interpreter inside a function imported from a module. For instance, imagine that my

Re: [Tutor] namespaces and global

2009-10-14 Thread Kent Johnson
On Wed, Oct 14, 2009 at 7:26 AM, Jose Amoreira wrote: > I want to use a variable defined in an interactive session with the python > interpreter inside a function imported from a module. > > For instance, imagine that my module (call it defs.py, for instance) consists > of: > #coding=utf-8 > def

Re: [Tutor] Help or Advice on MySQL, Python and test data storage

2009-10-14 Thread greg whittier
On Thu, Oct 8, 2009 at 4:29 AM, David Jamieson wrote: > Hi All, > looking for some advice on using Python with MySQL for test data > storage. > While not a relational database, you might also look at http://www.pytables.org. It provides a python interface for writing to and reading from hdf5 fil

Re: [Tutor] Finding and Inserting missing dates in a date range.

2009-10-14 Thread Glen Zangirolami
I went ahead and used a date range generator: http://dpaste.com/107140/ to iterate over the range.I then compared the original list with the generated one and inserted the missing dates. I was comparing the generated dates to dates in a list list of tuples: [(date, count), (date, count) . (dat

Re: [Tutor] Recursive user input collection problem

2009-10-14 Thread William Witteman
Thanks to all who responded. There were several good points about the code itself, all of which both helped and work. I will likely use Alan's example because I find it the most lucid, but the other suggestions are good signposts to other ways to do the same thing (but right, as opposed to how I

[Tutor] Not storing the PATH in ZipFile?

2009-10-14 Thread Nick Hird
I was reading another thread and decided to work on a little project to backup some files on a regular basis. Since this will mostly be on windows i am using zipfile and i can create my zip file just fine and all the files are there, it works great! My question is however, is there a way to NOT sto

Re: [Tutor] Not storing the PATH in ZipFile?

2009-10-14 Thread Kent Johnson
On Wed, Oct 14, 2009 at 11:38 AM, Nick Hird wrote: > I was reading another thread and decided to work on a little project > to backup some files on a regular basis. Since this will mostly be on > windows i am using zipfile and i can create my zip file just fine and > all the files are there, it wo

Re: [Tutor] Not storing the PATH in ZipFile?

2009-10-14 Thread Nick Hird
That was it. Thanks so much! I was looking at the docs and didn't think that applied to the path that was stored. Thanks Again! -Nick On Wed, Oct 14, 2009 at 12:16 PM, Kent Johnson wrote: > On Wed, Oct 14, 2009 at 11:38 AM, Nick Hird wrote: >> I was reading another thread and decided to work on

Re: [Tutor] PyWin32 - Library of functions to interact with windows?

2009-10-14 Thread Katt
Hello all, I am currently using WinXP and python 2.6.2 I just installed PyWin32 v214 for python 2.6 from the following link: http://sourceforge.net/projects/pywin32/files/pywin32/Build%20214/pywin32-214.win32-py2.6.exe/download Installation seemed to go good as it walked me through while locati

Re: [Tutor] namespaces and global

2009-10-14 Thread Alan Gauld
"Jose Amoreira" wrote Of course I could redefine my module function, including the parameter a in the list of arguments, but I'd rather not. Why not? That would be good computer science practice and the most reliable way to do it. Why do you not want to go down that route? Is there a specif

Re: [Tutor] PyWin32 - Library of functions to interact with windows?

2009-10-14 Thread Alan Gauld
"Katt" wrote I am currently using WinXP and python 2.6.2 I just installed PyWin32 v214 for python 2.6 from the following link: Well done! :-) Now I find myself scratching my head and saying to myself: "now what?" Good question. Why did you download and install it? Did you have a specific

Re: [Tutor] PyWin32 - Library of functions to interact with windows?

2009-10-14 Thread Scott Nelson
If I may chime in... As Alan said, pywin is basically a thin wrapper around the Win32 API. The Win32 API is very complex. Thus pywin is, by necessity, also very complex. There is documentation for pywin, but it is very minimal as you've probably noticed. If you are a *very* bold beginner with l

Re: [Tutor] PyWin32 - Library of functions to interact with windows?

2009-10-14 Thread Kent Johnson
On Wed, Oct 14, 2009 at 12:38 PM, Katt wrote: > Searching the web I have found a lot of general information or overly > specific with no way to narrow my search to what I am looking for.  I am not > sure, but it seems very difficult just to search for a way to change the > color of my text. Did

[Tutor] Masking operation

2009-10-14 Thread Wayne
I've searched "Python masking" and various other terms in Google and the python docs and came up with nothing useful. This is just a bit of a hobby project that was inspired by some assembly homework that one of my friends is now doing and I did last semester. The assignment was to create a program

Re: [Tutor] namespaces and global

2009-10-14 Thread Jose Amoreira
Alan, Kent, hello! Thanks for your help. As for your "curiosity", I'm teaching elementary physics to undergraduates in computer engineering. Trying to speak my students' language, I wanted to show them simple applications that compute numerical values for the kinematics formulas of uniformly acc

Re: [Tutor] Masking operation

2009-10-14 Thread Rich Lovely
2009/10/14 Wayne : > I've searched "Python masking" and various other terms in Google and the > python docs and came up with nothing useful. > This is just a bit of a hobby project that was inspired by some assembly > homework that one of my friends is now doing and I did last semester. The > assig

Re: [Tutor] PyWin32 - Library of functions to interact with windows?

2009-10-14 Thread Alan Gauld
"Scott Nelson" wrote myself and I recently found some C code on the web [2] that does this and I translated that into to Python and pywin. It can be done in about 4 lines of Python. Yes, its much easier than I expected. I had never seen the SetConsoleTextAttribute API call before nor the

Re: [Tutor] Masking operation

2009-10-14 Thread Alan Gauld
"Wayne" wrote I've searched "Python masking" and various other terms in Google and the python docs and came up with nothing useful. Try the Using the OS topic in my tutorial. There is a sidebar in there about using the bitwise operators to do masking about half way down. HTH, -- Alan Gau

Re: [Tutor] Masking operation

2009-10-14 Thread Wayne
On Wed, Oct 14, 2009 at 6:31 PM, Rich Lovely wrote: > > Specifically, cycle and izip. itertools.cycle is the trick here, izip > is a more efficient (in this case) version of zip. Ahah! Cycle is exactly what I wanted - I thought there was something like this but I forgot where I found it. Using

Re: [Tutor] Changing the color of text in the windows shell (WinXP/python 2.6.2)

2009-10-14 Thread Katt
Hello All, Message: 4 Date: Wed, 14 Oct 2009 18:38:31 +0100 From: "Alan Gauld" To: tutor@python.org Subject: Re: [Tutor] PyWin32 - Library of functions to interact with windows? "Katt" wrote Now I find myself scratching my head and saying to myself: "now what?" Good question. Why did you