[Tutor] Registry Stuff

2004-12-21 Thread Jacob S.
Hi, A little while ago, someone posted a message about an error and something about modifying the windows registry key HKEY_CURRENT_USER\Control Panel\Desktop so that the value Wallpaper was changed periodically. I wonder if anyone could tell me how to do that? I tried something, and it didn't

Tix Select programming problem + Re: [Tutor] Tix NoteBook programming problem

2004-12-21 Thread Guillermo Fernandez Castellanos
Hi, Thanks for the answer. The intial code works indeed as soon as I put out the lines: hd.pack() gf.pack() I'm playing now with the Select buttons: import Tix def prtS(): print fruits.cget('value') def prtC(val): print val print sel.cget('value') root = Tix.Tk() fruits=Tix.Select

Re: [Tutor] Comments appreciated

2004-12-21 Thread Jeff Shannon
Luis N wrote: This is the most meaningful thing this newbie has ever done. Comments are appreciated: Okay, here's a few thoughts... junk = [] for arg in sys.argv: junk.append(arg) junk = junk[1:] You can write these four lines much simpler as: junk = sys.argv[1:] if len(junk) is 0 and empty ==

[Tutor] Comments appreciated

2004-12-21 Thread Luis N
This is the most meaningful thing this newbie has ever done. Comments are appreciated: #!/usr/local/bin/python trashcan = "/home/anewby/.trashcan" import os, sys, shutil junk = [] for arg in sys.argv: junk.append(arg) junk = junk[1:] empty = False if "-e" in junk: empty = True ju

Re: [Tutor] implementing a table data structure in python?

2004-12-21 Thread Thomas Clive Richards
On Wednesday December 22 2004 11:58 am, Alan Gauld wrote: > > Hows about a dictionary of lists. A key per column. The > users pick which columns and you retrieve the lists. And > of course shelve will treat a file like a dictionary... > Ahhh that's better.. I guess I should clarify: it's not

Re: [Tutor] implementing a table data structure in python?

2004-12-21 Thread Maarten
Juan Shen wrote: Maarten, First of all, welcome to [EMAIL PROTECTED] I've done a little modification on Kent's code to make it more sensible. Please try it. Thx, And how nice it is to learn Python from other people's problems and again other people's solutions :) Maarten

Re: [Tutor] implementing a table data structure in python?

2004-12-21 Thread Alan Gauld
> Still got a question. This notation/syntax of the list: > > [ item for i, item in data if i in columns ] > > is quite new for me. Can someone point me to more examples of this use > Or give me the name of it (it must have a name) so i can google it? Its a list comprehension, and theres a short e

Re: [Tutor] implementing a table data structure in python?

2004-12-21 Thread Alan Gauld
> Normally I'd use a database like mysql, postgreSQL, or even SQLite for this > sort of application, but the server I'm working on (which is outside my > control) does not have any of these installed. > > The CGI will not see heavy use, and I'm not very worried about race conditions > or collisions

Re: [Tutor] Tix NoteBook programming problem

2004-12-21 Thread Michael Lange
On Tue, 21 Dec 2004 14:16:56 +0900 Guillermo Fernandez Castellanos <[EMAIL PROTECTED]> wrote: Hi Guille, thats a classic case of geometry manager conflicts. You dont need to pack the notebook pages explicitely, tix does this automagically for you and *tix does not use pack()*, so when you try to

Re: [Tutor] implementing a table data structure in python?

2004-12-21 Thread Kent Johnson
Juan Shen wrote: My python code: #!/usr/bin/python #Filename: selectcolumn.py import sys datafile='mydata' #Your datafile columns=[1,2,3,5] #Columns which you'd like to print try: f=open(datafile) except IOError: print "Can't open data file." sys.exit() for line in list(f): data=line

Re: [Tutor] implementing a table data structure in python?

2004-12-21 Thread Juan Shen
Maarten, First of all, welcome to [EMAIL PROTECTED] I've done a little modification on Kent's code to make it more sensible. Please try it. Assuming the data file is 'mydata' $cat mydata 1 1 2 3 23 0.1 13 2 3 4 24 0.15 24 1

RE: [Tutor] Hi I made a mistake

2004-12-21 Thread Barnaby Scott
You *have* signed up to get help, it's just that you see all the mail to the mailing list. The requests for help go to all subscribers, not just a select group of 'tutors' - obviously you won't be offering solutions just yet, but maybe one day you will! This behaviour is the whole point of a mailin

RE: [Tutor] Hi I made a mistake

2004-12-21 Thread Robert, Andrew
Good morning Julias, The python tutor list is a give and take of python information. If can contribute to an explanation or resolve a problem, then please do so. Additionally, you can read the e-mail messages and learn from others on how they handle things. Thank you, Andrew Robert Systems Ar

Re: [Tutor] Hi I made a mistake

2004-12-21 Thread Kent Johnson
To get help on a specific topic, send a question to this list. (See, it's working already! :-) ) To learn about other topics, read the answers that others post. To unsubscribe, go to http://mail.python.org/mailman/listinfo/tutor and follow the directions. Kent Julius wrote: I am a beginner with P

Re: [Tutor] implementing a table data structure in python?

2004-12-21 Thread Kent Johnson
Maarten wrote: So maybe a bit bold for a newbie to start posting a correction but i wanted the code to work: Kent Johnson wrote: columns = [1,3,4] # Column numbers to show, 0-based f = open('mydata.txt') for line in f: data = line.split() # Assuming your data is tab- or space-delimited

Re: [Tutor] implementing a table data structure in python?

2004-12-21 Thread Maarten
Hello tutors, As i'm new to this mailing list so i shall introduce myself. My name is Maarten and except for some shell scripting I have little practical experience in programming (I'm a Linux/Solaris sys-admin). I've doing (mostly) reading about Python. But now trying, despite of my lack of ta

[Tutor] Hi I made a mistake

2004-12-21 Thread Julius
I am a beginner with Python, I originally tried to sign up to "GET" help, not to become a tutor, now i have alot of email everyday of people asking me questions, please take my name off the list, i won't be able to help, and please let me know how to sign up to get help :) -- Julius _

Re: [Tutor] unittesting and nested functions

2004-12-21 Thread Christian Meesters
Ken Johnson wrote: This should be self.failUnlessRaises(IOError, DNA, '1 ATG') In your usage, you are calling DNA() and passing the result of the call to failUnlessRaises(). The call to DNA raises IOError. This happens *before* the call to failUnlessRaises(), so it is interpreted as an error

Re: [Tutor] unittesting and nested functions

2004-12-21 Thread Yigal Duppen
On Monday 20 December 2004 21:16, Christian Meesters wrote: > Hi > > I've written some unittests using the unittest module for my > 'DNA-class'. This class can cope with almost every input, but with no > 'numbers' whatsoever. Well, one of the tests is: > > class TestFunctions(unittest.TestCase): >

Re: [Tutor] implementing a table data structure in python?

2004-12-21 Thread Kent Johnson
Thomas Clive Richards wrote: Hi, I'm trying to implement a reasonably efficient table data structure, but ith a few quirks... The application I'm building is a CGI program which allows users to view a large table of data. In addition, users can restrict the data shown. Some sample data might lo