Re: [Tutor] Matrix

2004-12-20 Thread Alan Gauld
> A list of lists is the most logical construction. > But -- you don't need to assemble the rows separately -- > this works too: > >>> my_matrix_as_lists = [ [4, 6, 8, 1],\ > ... [2, 5, 1, 3],\ > ... [2, 1, 2, 8] ] And you don't need the line continuation characters either. Because Python ca

Re: [Tutor] Printing two elements in a list

2004-12-20 Thread Max Noel
On Dec 19, 2004, at 06:16, Jacob S. wrote: Would this work for you? a = ['Name = stuff','CGTATAGCTAGCTA','Name = stuff','CGATATGCCGGCTA'] for index,thing in enumerate(a): if "Name=" in thing: del a[index] I know, that it might be slow, but I thought that maybe it would hold its own bec

Re: [Tutor] Printing two elements in a list

2004-12-20 Thread Kent Johnson
Max Noel wrote: On Dec 19, 2004, at 06:16, Jacob S. wrote: Would this work for you? a = ['Name = stuff','CGTATAGCTAGCTA','Name = stuff','CGATATGCCGGCTA'] for index,thing in enumerate(a): if "Name=" in thing: del a[index] A faster way to do this would be to use something like: if thi

Re: [Tutor] Tkinter questions

2004-12-20 Thread Alan Gauld
> > I find the easiest way is to create an PhotoImage object attach > > the graphic file(jpg,bmp,gif) to that and assign the PhotoImage > > object to the Button.image property. You can "animate" the image > > by simply reassigning the file to the underlying PhotoImage onject. > Thanks, but a pract

Re: [Tutor] class overriding question

2004-12-20 Thread Alan Gauld
You've got it right Brian. It is this ability to change the way *existing* code works that makes OOP more than a neat way to package data and functions. This is polymorphism at its most powerful. Its why in a C++/Java world the convention is to write hook methods that are called by the public meth

Re: [Tutor] Tkinter questions

2004-12-20 Thread Mark Kels
On Mon, 20 Dec 2004 18:21:13 +1300, Liam Clarke <[EMAIL PROTECTED]> wrote: > from Tkinter import * > import Image, ImageTk > root = Tk() > img = Image.open('SonicCruiser.gif') > phi = ImageTk.PhotoImage(img) > button = Button(root, image=phi) > button.pack() > root.mainloop() Thank you !! But I d

Re: [Tutor] class overriding question

2004-12-20 Thread Brian van den Broek
Alan Gauld said unto the world upon 2004-12-20 09:27: Its another reason why you should never refer to an object or method *calling* another method (as Pilgrim does). Rather think of the method sending a *message* to the self object which invokes the appropriate method. This decoupling of message

[Tutor] A better way to do it.

2004-12-20 Thread Jacob S.
Okay, here's the code. I am completely open to suggestions as this is my first dabbling in Tk. Please look over it when you have time. I have a couple of questions. 1) How do I change the title of the window? 2) Why does a window pop up saying something like error, the memory could not be "read".

Re: [Tutor] Printing two elements in a list

2004-12-20 Thread Jacob S.
Duh, whack myself on the head a few times. Thanks, Jacob > Max Noel wrote: > > > > On Dec 19, 2004, at 06:16, Jacob S. wrote: > > > >> Would this work for you? > >> > >> a = ['Name = stuff','CGTATAGCTAGCTA','Name = stuff','CGATATGCCGGCTA'] > >> for index,thing in enumerate(a): > >> if "Name=

Re: [Tutor] Re: Printing two elements in a list

2004-12-20 Thread Jacob S.
That's interesting, I hadn't thought of that! Jacob > Jacob S. wrote: > > > Would this work for you? > > > > a = ['Name = stuff','CGTATAGCTAGCTA','Name = stuff','CGATATGCCGGCTA'] > > for index,thing in enumerate(a): > > if "Name=" in thing: > > del a[index] > > > > I know, that it mig

Re: [Tutor] Python 2.4 IDLE Windows 2000

2004-12-20 Thread Danny Yoo
On Sat, 18 Dec 2004, Jacob S. wrote: > I think I'm going to burst out in tears. Mike Hansen gave the solution > to the very problem I'm having, yet, when I used the console version and > deleted the custom color theme, it stopped giving me error messages, but > it still won't start up without th

Re: [Tutor] Python 2.4 IDLE Windows 2000

2004-12-20 Thread EJP
"Jacob S." <[EMAIL PROTECTED]> > Gee, > I think I'm going to burst out in tears. > Mike Hansen gave the solution to the very problem I'm having, yet, when > I > used the console version and deleted the custom color theme, it stopped > giving me error messages, but it still won't start up without

Re: [Tutor] Matrix

2004-12-20 Thread Danny Yoo
On Sun, 19 Dec 2004, Bugra Cakir wrote: > I want to create a matrix in Python. For example 3x4 how can i > create this? thanks Hi Bugra, Just for reference, here's the relevant FAQ about how to do matrices in Python: http://python.org/doc/faq/programming.html#how-do-i-create-a-multidimension

[Tutor] unittesting and nested functions

2004-12-20 Thread Christian Meesters
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): ... def test__init__(self): """testing whether __init__ w

Re: [Tutor] Matrix

2004-12-20 Thread Bob Gailer
On Sun, 19 Dec 2004, Bugra Cakir wrote: > I want to create a matrix in Python. For example 3x4 how can i > create this? thanks Just for the heck of it would you tell us what you want to do with the matrix? Sometimes there are interesting alternate ways to do things that might not be obvious to a

Re: [Tutor] unittesting and nested functions

2004-12-20 Thread Kent Johnson
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): ... def test__init__(self): """

Re: [Tutor] class overriding question

2004-12-20 Thread Alan Gauld
> > Its another reason why you should never refer to > > an object or method *calling* another method > > (as Pilgrim does). Rather think of the method > > sending a *message* to the self object which > > invokes the appropriate method. > The contrast you suggest between calling a method and sendi

Re: [Tutor] class overriding question

2004-12-20 Thread Brian van den Broek
Alan Gauld said unto the world upon 2004-12-20 15:51: I hope that short history of OOP clarifies rather than confuses! :-) Alan G. Thanks for that Alan. Seems to clarify thing to me ;-) Best, Brian vdB ___ Tutor maillist - [EMAIL PROTECTED] http://mail

Re: [Tutor] Python 2.4 IDLE Windows 2000

2004-12-20 Thread Jacob S.
Ah, hah! Okay, everyone! It took two things. 1) Delete .idlerc directory 2) Uninstall and reinstall python2.4 Why I had to do step two is beyond me, but I've got it settled now! Thank you, Jacob Schmidt > > "Jacob S." <[EMAIL PROTECTED]> > > > Gee, > > I think I'm going to burst out in tears. >

Re: [Tutor] Python 2.4 IDLE Windows 2000

2004-12-20 Thread Danny Yoo
On Mon, 20 Dec 2004, Jacob S. wrote: > 1) Delete .idlerc directory > 2) Uninstall and reinstall python2.4 Hi Jacob, Ok, so there was probably something really screwy with the stuff in .idlerc. Can you send me a tarball or zip of it in private email? I just want to make sure that the issue t

[Tutor] Tix NoteBook programming problem

2004-12-20 Thread Guillermo Fernandez Castellanos
Hi, I'm trying to figure out how to work with Tix. The lack of examples and avalaibility of documentation for TCL only do not help :-( It does not work because when I start the program, the red and gren buttons start blinking betweeb 2 or 3 different places, no matter what the tab is. Here is th

[Tutor] implementing a table data structure in python?

2004-12-20 Thread Thomas Clive Richards
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 look like this: (note you'll