Re: [Tutor] Best GUI toolkit?

2006-10-19 Thread Christopher Hatherly
Hi Luke, Thanks very much! I do need some GUI widgets as well, so reckon I might try PyGame with OpenGL as you suggest, and go for a basic GUI library for PyGame. After looking round, I'm now having a closer look at Phil's Pygame Utilities (PGU - www.imitationpickles.org/pgu/ which seems pretty go

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Chris Hengge
Oops, my mistake, I did read your code, as well as all the others and I had your code mixed with another submission. In that case, excellent contribution =DOn 10/19/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Chris Hengge wrote:> More on that.. some of the file I work with are thousands of li

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Luke Paireepinart
Chris Hengge wrote: > More on that.. some of the file I work with are thousands of lines > long... one is even 10's of thousands.. so reading the entire thing > into ram is MUCH faster then reading line by line with the filestream > open. Did you look at my code? It doesn't read the whole thing

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Chris Hengge
More on that.. some of the file I work with are thousands of lines long... one is even 10's of thousands.. so reading the entire thing into ram is MUCH faster then reading line by line with the filestream open. On 10/19/06, Chris Hengge <[EMAIL PROTECTED]> wrote: I dont care for slow... I dont use

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Chris Hengge
I dont care for slow... I dont use computers with less then 1gb of ram.. (all my systems have 2gb), I hate to wait... =D If I've got memory to use, I intend to use it!As for reading 100 20mb files, I'd do one at a time, then dump the variable storing the data, or reset/re-use. Just my take though.

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Luke Paireepinart
Chris Hengge wrote: > I thought my solution was the easiest.. but I guess everyone skipped it =P No, we didn't skip it, but as we're all programmers here, we showed alternate ways that it could be done. Your post is the one that sparked the whole 'garbage collection' thing, you'll notice. Now, I

Re: [Tutor] Resources for Tkinter...

2006-10-19 Thread Asrarahmed Kadri
    I came across Thinking in Tkinter a few days back., and I found it interesting but then I didnt get the print out ( dont know why)...    Thanks for that.   Regards, Asrarahmed   PS: To Bob:: To HIM you shall return--->> It means that one day every person has to die and return to the Almighty t

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Chris Hengge
I thought my solution was the easiest.. but I guess everyone skipped it =POn 10/19/06, Kent Johnson <[EMAIL PROTECTED] > wrote:Danny Yoo wrote:>> file('filename.txt').readlines()[-1] Not to hijack the thread, but what stops you from just putting a file.close() after your example line?>

Re: [Tutor] Resources for Tkinter...

2006-10-19 Thread Feise, David
I really got a lot out of Thinking in Tkinter: http://www.ferg.org/thinking_in_tkinter/ It doesn’t delve too deeply, but it’s still a good resource.    This New Mexico Tech website is a good reference once you’ve got some of the basics: http://infohost.nmt.edu/tcc/help/pubs/tkinter/  

Re: [Tutor] Resources for Tkinter...

2006-10-19 Thread Bob Gailer
Asrarahmed Kadri wrote: > > Folks, > > I have the Tkinter book by Grayson (Python and Tkinter Programming).. > *But I must say, its quite boring..* Boring - what exactly do you mean? What would make a book "nice"? And please tell us the meaning or significance of "To HIM you shall return."

[Tutor] Resources for Tkinter...

2006-10-19 Thread Asrarahmed Kadri
  Folks,   I have the Tkinter book by Grayson  (Python and Tkinter Programming).. But I must say, its quite boring..   Do you have any suggestions for  a nice book or web resource..??   Thanks,   REgards, Asrarahmed-- To HIM you shall return. ___ Tutor m

Re: [Tutor] property built-in

2006-10-19 Thread John Fouhy
On 20/10/06, Kent Johnson <[EMAIL PROTECTED]> wrote: > wesley chun wrote: > > on a related note, if you're using Python 2.4 and newer, you can > > simplfy your code a bit by replacing the call to property() with a > > decorator for x, as in: > > > > @property > > def x(): > > : > > I don't thin

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Kent Johnson
Danny Yoo wrote: > > file('filename.txt').readlines()[-1] Not to hijack the thread, but what stops you from just putting a file.close() after your example line? >>> Which file should file.close() close? The problem is that we don't >>> have a handle on the particular file we want

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Asrarahmed Kadri
Danny This is a very clean way to get the last line.   Thanks. Regards, Asrarahmed  On 10/19/06, Danny Yoo <[EMAIL PROTECTED]> wrote: > first count the number of lines in the file by using a loop. Use a> second loop and when teh counter reaches the num_of_lines values: take > the line.>> Is th

Re: [Tutor] How to know which module the function belongs to...??

2006-10-19 Thread Kent Johnson
Asrarahmed Kadri wrote: > > I tried to use getchar()... But I dont know which module it belongs > (this I came to know when I encountered an error)..!! > > Is there a good documentation by which we can search both ways... Look > at modules as well as search for a particular function and locate

[Tutor] How to know which module the function belongs to...??

2006-10-19 Thread Asrarahmed Kadri
I tried to use getchar()... But I dont know which module it belongs (this I came to know when I encountered an error)..!!   Is there a good documentation by which we can search both ways... Look at modules as well as search for a particular function and locate which module it belongs to...   Thanks

Re: [Tutor] property built-in

2006-10-19 Thread Kent Johnson
wesley chun wrote: >>> x= property(**x()) >>> >>> questions: >>> 1: why doesn't there have to be a self in x()? >> x is not a "normal" class method. It is only used as a container to >> hold the "real" methods which are returned in the locals() dictionary. > > > on a related note, if you

Re: [Tutor] Location of found item in list.

2006-10-19 Thread Luke Paireepinart
Chris Hengge wrote: > This is the solution I came up with. > > for dirItem in directoryList: > directoryListLower.append(dirItem.lower()) > > #---Loop for file name comparison. > for item in lineList: # For every item in the 'lineList' > if item in directoryList: # If th

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Chris Hengge
Very informative and creative reply! Thanks for sharing :]On 10/19/06, Danny Yoo <[EMAIL PROTECTED] > wrote:>> >> file('filename.txt').readlines()[-1]>> >> > Not to hijack the thread, but what stops you from just putting a>> > file.close() after your example line? Which file should file.close()

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Danny Yoo
>> >> file('filename.txt').readlines()[-1] >> >> > Not to hijack the thread, but what stops you from just putting a >> > file.close() after your example line? >> >> Which file should file.close() close? The problem is that we don't >> have a handle on the particular file we want to close off

Re: [Tutor] Generic Application Frameworks?

2006-10-19 Thread Chris Hengge
About frameworks being complicated... I'm sure there are exceptions to this, but my experience is that if you think of a framework as a tool, sure , you gotta learn how to use it first, which means it will slow you down upfront.. But.. once you know how to use the tool in theory it will make your j

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Danny Yoo
> This works as well > > file('filename.txt').readlines()[-1] > > Some will say that this is no good because the file is still open. > However I've been told that when the object is cleaned the file is > closed so it should be fine. It matters in an implementation like Jython, which depends on t

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Chris Hengge
Oh wow.. I totally missed that... nevermind.. ignore that question =DOn 10/19/06, Danny Yoo <[EMAIL PROTECTED] > wrote:>> file('filename.txt').readlines()[-1]> Not to hijack the thread, but what stops you from just putting a > file.close() after your example line?Which file should file.close() clos

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Danny Yoo
>> file('filename.txt').readlines()[-1] > Not to hijack the thread, but what stops you from just putting a > file.close() after your example line? Which file should file.close() close? The problem is that we don't have a handle on the particular file we want to close off. ___

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Danny Yoo
> first count the number of lines in the file by using a loop. Use a > second loop and when teh counter reaches the num_of_lines values: take > the line. > > Is there any other way to do it?? Yes, there's a way to do it in one pass: you can keep track of the very last line you've read from the

Re: [Tutor] property built-in

2006-10-19 Thread wesley chun
> > x= property(**x()) > > > > questions: > > 1: why doesn't there have to be a self in x()? > > x is not a "normal" class method. It is only used as a container to > hold the "real" methods which are returned in the locals() dictionary. on a related note, if you're using Python 2.4 and

Re: [Tutor] Generic Application Frameworks?

2006-10-19 Thread Chris Hengge
http://dabodev.com/aboutHere we go... 3 tier application framework.. Thats almost perfect.. I suppose I could figure out the auto update thing myself... since that is all that it is missing for what I was wanting.. Thanks again! On 10/19/06, Chris Hengge <[EMAIL PROTECTED]> wrote: I ran a couple se

Re: [Tutor] Generic Application Frameworks?

2006-10-19 Thread Mike Hansen
[...] I don't believe there's any limitation in python. I suspect it's mostly philosophical. <-- What did you mean by this Mike? import this "Simple is better than complex." "Complex is better than complicated." I'm kind of torn on using frame

Re: [Tutor] Generic Application Frameworks?

2006-10-19 Thread Chris Hengge
I ran a couple searches for one, and mostly got scientific or web based projects.. I was just looking for a basic desktop framework to handle common tasks that aren't so easy to impliment like the ones I mentioned. Thanks for that repository! I hadn't seen that before.. I'm looking at plugboard now

Re: [Tutor] Generic Application Frameworks?

2006-10-19 Thread Mike Hansen
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Hengge Sent: Thursday, October 19, 2006 1:22 PM To: PyTutor Subject: Re: [Tutor] Generic Application Frameworks? Just incase anyone doesn't want to see that document to k

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Jordan Greenberg
Chris Hengge wrote: > Not to hijack the thread, but what stops you from just putting a > file.close() > after your example line? Because file is a class. file(filename) creates a file object, but he's not saving the object to a variable, so its lost. file.close() takes a file object as a parameter

Re: [Tutor] Generic Application Frameworks?

2006-10-19 Thread Chris Hengge
Just incase anyone doesn't want to see that document to know what I'm asking about...Razor/Carbon includes:Auto UpdatePlugin System with managementError reportingIts got a few other features, but these are my focus. On 10/19/06, Chris Hengge <[EMAIL PROTECTED]> wrote: I was curious if there are any

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Chris Hengge
Not to hijack the thread, but what stops you from just putting a file.close() after your example line?On 10/19/06, Chad Crabtree < [EMAIL PROTECTED]> wrote:file('filename.txt').readlines()[-1] Some will say that this is no good because the file is still open.  However I've been told that when the o

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Chad Crabtree
On 10/19/06, Chris Hengge <[EMAIL PROTECTED]> wrote: I'd personally do something like this. file = open(myfile, 'r')fileContents = file.readlines() # read the entire document into memory for speed.file.close()print fileContents[-1] # This is the last line. This works as wellfile('filename.txt').rea

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Brian van den Broek
Asrarahmed Kadri said unto the world upon 19/10/06 12:55 PM: > My algorithm is like this: > first count the number of lines in the file by using a loop. > Use a second loop and when teh counter reaches the num_of_lines values: > take > the line. > > Is there any other way to do it?? > > > > On

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Chris Hengge
I'd personally do something like this. file = open(myfile, 'r')fileContents = file.readlines() # read the entire document into memory for speed.file.close()print fileContents[-1] # This is the last line. On 10/19/06, Asrarahmed Kadri <[EMAIL PROTECTED]> wrote: My algorithm is like this: first count

Re: [Tutor] Location of found item in list.

2006-10-19 Thread Chris Hengge
This is the solution I came up with.     for dirItem in directoryList:    directoryListLower.append(dirItem.lower())    #---Loop for file name comparison.    for item in lineList: # For every item in the 'lineList'     if item in directoryList: # If the item is also in 'directoryList'  

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Asrarahmed Kadri
My algorithm is like this: first count the number of lines in the file by using a loop. Use a second loop and when teh counter reaches the num_of_lines values: take the line.   Is there any other way to do it??   On 10/19/06, Danny Yoo <[EMAIL PROTECTED]> wrote: On Thu, 19 Oct 2006, Asrarahmed Kadr

Re: [Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Danny Yoo
On Thu, 19 Oct 2006, Asrarahmed Kadri wrote: > I want to extract the last line of the text file. Any idea ??? Hi Asrarahmed, Ok, so what part do you get stuck on when you try to do this? That is, what sort of things do you already know how to do with files? __

[Tutor] Trying to extract the last line of a text file

2006-10-19 Thread Asrarahmed Kadri
  Hi Folks,   I want to extract the last line of the text file. Any idea ???   Thanks, Regards, Asrarahmed-- To HIM you shall return. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] property built-in

2006-10-19 Thread Python
On Thu, 2006-10-19 at 19:03 +0200, thomas wrote: > Hi, > > > I was wondering some things about property. > > suppose I have a class like this: > > class A(object): > def __init__(self, x, y): >self.__x = x > > def x(): >def get(self): fget > retur

[Tutor] property built-in

2006-10-19 Thread thomas
Hi, I was wondering some things about property. suppose I have a class like this: class A(object): def __init__(self, x, y): self.__x = x def x(): def get(self): return self.__x def set(self, x): self.__x = x #and some other code that

[Tutor] Generic Application Frameworks?

2006-10-19 Thread Chris Hengge
I was curious if there are any frameworks around like carbon/razor implimented in razor? Here's a link with information about razor (.net 1.1 versin of carbon) http://www.codeproject.com/cs/design/razorpt1.aspIf not, is there any reason why? (limitation of python?) _

Re: [Tutor] Sharing data between modules

2006-10-19 Thread Dave Kuhlman
On Thu, Oct 19, 2006 at 10:41:27AM +0100, [EMAIL PROTECTED] wrote: > Hi > > just starting to get to grips with writing GUIs in Python using wxPython and > not being a computer scientist, have a philosophical question about the > "best" > way to pass data between various modules. For example, I

Re: [Tutor] Sharing data between modules

2006-10-19 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Hi > > just starting to get to grips with writing GUIs in Python using wxPython and > not being a computer scientist, have a philosophical question about the > "best" > way to pass data between various modules. For example, I anticipate having > one module to look a

Re: [Tutor] Sharing data between modules

2006-10-19 Thread Python
On Thu, 2006-10-19 at 10:41 +0100, [EMAIL PROTECTED] wrote: > Hi > > just starting to get to grips with writing GUIs in Python using wxPython and > not being a computer scientist, have a philosophical question about the > "best" > way to pass data between various modules. For example, I antici

Re: [Tutor] Sharing data between modules

2006-10-19 Thread johnf
On Thursday 19 October 2006 02:41, [EMAIL PROTECTED] wrote: > Hi > > just starting to get to grips with writing GUIs in Python using wxPython > and not being a computer scientist, have a philosophical question about the > "best" way to pass data between various modules. For example, I anticipate >

Re: [Tutor] passing a variable ?

2006-10-19 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > I am stumped. I am trying to pass the variable 'savename' to a string > and get errors. > can someone tell me why? Thanks to all on this list. (The problem > happens in the for loop 1st line) > > This is my error > Traceback (most recent call last): > File "./ArpA

Re: [Tutor] passing a variable ?

2006-10-19 Thread Jason Massey
It should look like this:fout = file('/home/cable/sandbox/%s' % savename, 'a''w')The variables come immediately after the string your formatting.On 10/19/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I am stumped.  I am trying to pass the variable 'savename' to a stringand get errors.can someon

[Tutor] passing a variable ?

2006-10-19 Thread dpotter
I am stumped. I am trying to pass the variable 'savename' to a string and get errors. can someone tell me why? Thanks to all on this list. (The problem happens in the for loop 1st line) This is my error Traceback (most recent call last): File "./ArpAcl.py", line 39, in ? fout = file('/h

[Tutor] Writing serialized objects from BaseHTTPServer

2006-10-19 Thread Arun Kumar PG
Hi Guys,I wrote a simple server using sockets ,the traditional whille True: scoket.accept() approach. This server reads some pickled parameters sent by the client using the cPickle module -> do some processing -> and finally writes a list of tuples, objects using cPickle back to the client output s

[Tutor] Sharing data between modules

2006-10-19 Thread etrade . griffiths
Hi just starting to get to grips with writing GUIs in Python using wxPython and not being a computer scientist, have a philosophical question about the "best" way to pass data between various modules. For example, I anticipate having one module to look after the GUI stuff where users can input