Re: [Tutor] Questions

2019-04-08 Thread William Ray Wing via Tutor
Diana, I’m answering you via the Tutor list - please, the accepted protocol is to send all questions and answers to the list so answers can be seen by (and possibly help) others. Having said that, I should have paid more attention to your original question, which is really going to require answ

Re: [Tutor] Questions

2019-04-08 Thread George Fischhof
Diana Katz ezt írta (időpont: 2019. ápr. 7., V, 10:01): > 1) Can you use python from excel? Or just export to excel? > 2) I am trying to see if there's a way using python to automate all of this > work that I need to do. I have to collect quarterly segment data for > hundreds of public companies

Re: [Tutor] Questions about the deprecation of standard library modules

2019-04-02 Thread Steven D'Aprano
On Sat, Mar 30, 2019 at 10:13:16PM -0500, boB Stepp wrote: > So my main question is how does one know in which Python version a > deprecated module will be removed? I'm not too concerned about the > imp module, but _do_ want to know how the removal process works for > deprecated standard library

Re: [Tutor] Questions about the deprecation of standard library modules

2019-03-30 Thread Mats Wichmann
On March 30, 2019 9:13:16 PM MDT, boB Stepp wrote: >While reading in chapter 3 of "Learning Python, 5th ed." by Mark Lutz, >I was playing around with reload() in the imp module. In the >interpreter I did a "from imp import reload" and then help(reload). >This had a warning that it was deprecated.

Re: [Tutor] Questions about the formatting of docstrings

2018-07-28 Thread Albert-Jan Roskam
On 27 Jul 2018 06:34, boB Stepp wrote: I am near the end of reading "Documenting Python Code: A Complete Guide" by James Mertz, found at https://realpython.com/documenting-python-code/ This has led me to a few questions: (1) The author claims that reStructuredText is the official Python doc

Re: [Tutor] Questions about the formatting of docstrings

2018-07-27 Thread Mats Wichmann
On 07/27/2018 11:23 AM, boB Stepp wrote: > On Fri, Jul 27, 2018 at 12:50 AM Steven D'Aprano wrote: >> >> On Thu, Jul 26, 2018 at 11:34:11PM -0500, boB Stepp wrote: > >>> (1) The author claims that reStructuredText is the official Python >>> documentation standard. Is this true? If yes, is this

Re: [Tutor] Questions about the formatting of docstrings

2018-07-27 Thread boB Stepp
On Fri, Jul 27, 2018 at 12:50 AM Steven D'Aprano wrote: > > On Thu, Jul 26, 2018 at 11:34:11PM -0500, boB Stepp wrote: > > (1) The author claims that reStructuredText is the official Python > > documentation standard. Is this true? If yes, is this something I > > should be doing for my own proj

Re: [Tutor] Questions about the formatting of docstrings

2018-07-26 Thread Steven D'Aprano
On Thu, Jul 26, 2018 at 11:34:11PM -0500, boB Stepp wrote: > I am near the end of reading "Documenting Python Code: A Complete > Guide" by James Mertz, found at > https://realpython.com/documenting-python-code/ This has led me to a > few questions: > > (1) The author claims that reStructuredTex

Re: [Tutor] Questions as to how to run the same unit test multiple times on varying input data.

2016-09-24 Thread boB Stepp
On Sat, Sep 24, 2016 at 11:05 PM, Steven D'Aprano wrote: > On Sat, Sep 24, 2016 at 12:55:28AM -0500, boB Stepp wrote: >> def right_justify(a_string): >> '''This fucntion will take the string, "a_string", and left justify it by > > Left justify? Oops! Typo. [snip] > def test_random_str

Re: [Tutor] Questions as to how to run the same unit test multiple times on varying input data.

2016-09-24 Thread Steven D'Aprano
On Sat, Sep 24, 2016 at 12:55:28AM -0500, boB Stepp wrote: > "Write a function named right_justify that takes a string named s as a > parameter and prints the string with enough leading spaces so that the > last letter of the string is in column 70 of the display. Hint: Use > concatenation and r

Re: [Tutor] Questions as to how to run the same unit test multiple times on varying input data.

2016-09-24 Thread boB Stepp
On Sat, Sep 24, 2016 at 2:04 AM, Ben Finney wrote: > Bob, you may want to also subscribe to the specific forum for testing in > Python http://lists.idyll.org/listinfo/testing-in-python>. You're > beyond the beginner material that's usually discussed on this Tutor forum. Honestly, Ben, I thought t

Re: [Tutor] Questions as to how to run the same unit test multiple times on varying input data.

2016-09-24 Thread Walter Prins
Hi, On 24 September 2016 at 06:55, boB Stepp wrote: > > def test_returned_len_is_70(self): > '''Check that the string returned by "right_justify(a_string)" is the > length of the entire line, i.e., 70 columns.''' > > for test_string in self.test_strings: >

Re: [Tutor] Questions as to how to run the same unit test multiple times on varying input data.

2016-09-24 Thread Ben Finney
Bob, you may want to also subscribe to the specific forum for testing in Python http://lists.idyll.org/listinfo/testing-in-python>. You're beyond the beginner material that's usually discussed on this Tutor forum. boB Stepp writes: > What I struggled with was getting tests to run for ALL of the

Re: [Tutor] Questions as to how to run the same unit test multiple times on varying input data.

2016-09-23 Thread boB Stepp
I wanted to add a clarification as to what I was hoping to achieve. On Sat, Sep 24, 2016 at 12:55 AM, boB Stepp wrote: > > Of course, this code passed its test when the string was "Monty > Python", so I next wanted to run the same test with different strings > each time, so that my code would fai

Re: [Tutor] Questions (and initial responses) on using version control: Why cannot I push my single (master) branch to origin without an error occurring?

2015-05-02 Thread boB Stepp
On Sat, May 2, 2015 at 3:15 AM, Albert-Jan Roskam wrote: > Check out this page: > http://stackoverflow.com/questions/7861184/what-is-the-difference-between-git-init-and-git-init-bare > > Isn't the error you mentioned before the same? After reading everything on the page you link to, plus the lit

Re: [Tutor] Questions (and initial responses) on using version control: Why cannot I push my single (master) branch to origin without an error occurring?

2015-05-02 Thread Albert-Jan Roskam via Tutor
- On Sat, May 2, 2015 6:19 AM CEST boB Stepp wrote: >On Fri, May 1, 2015 at 1:41 PM, Albert-Jan Roskam wrote: >> >> >> On Fri, May 1, 2015 5:39 AM CEST boB Stepp wrote: >> >>I created my remote repository on, say my C-drive, with "git init

Re: [Tutor] Questions (and initial responses) on using version control: Why cannot I push my single (master) branch to origin without an error occurring?

2015-05-01 Thread boB Stepp
On Fri, May 1, 2015 at 1:41 PM, Albert-Jan Roskam wrote: > > > On Fri, May 1, 2015 5:39 AM CEST boB Stepp wrote: > >>I created my remote repository on, say my C-drive, with "git init". > > Not with 'git init --bare'? Should I have used the option --bare? I was followi

Re: [Tutor] Questions (and initial responses) on using version control: Why cannot I push my single (master) branch to origin without an error occurring?

2015-05-01 Thread boB Stepp
On Thu, Apr 30, 2015 at 11:21 PM, Alex Kleider wrote: > On 2015-04-30 20:39, boB Stepp wrote: >> >> I created my remote repository on, say my C-drive, with "git init". I >> then copied and pasted a file to that location and put it under >> version control with "git add filename.py". Next I went to

Re: [Tutor] Questions (and initial responses) on using version control: Why cannot I push my single (master) branch to origin without an error occurring?

2015-05-01 Thread Albert-Jan Roskam via Tutor
On Fri, May 1, 2015 5:39 AM CEST boB Stepp wrote: >I created my remote repository on, say my C-drive, with "git init". Not with 'git init --bare'? I usually prefer initializing a remote with a readme, so I can simply clone it and then populate it with files. No 'gi

Re: [Tutor] Questions (and initial responses) on using version control: Why cannot I push my single (master) branch to origin without an error occurring?

2015-05-01 Thread Albert-Jan Roskam via Tutor
On Fri, May 1, 2015 6:21 AM CEST Alex Kleider wrote: >On 2015-04-30 20:39, boB Stepp wrote: >> I created my remote repository on, say my C-drive, with "git init". I >> then copied and pasted a file to that location and put it under >> version control with "git add fil

Re: [Tutor] Questions (and initial responses) on using version control: Why cannot I push my single (master) branch to origin without an error occurring?

2015-04-30 Thread Alex Kleider
On 2015-04-30 20:39, boB Stepp wrote: I created my remote repository on, say my C-drive, with "git init". I then copied and pasted a file to that location and put it under version control with "git add filename.py". Next I went to my E-drive, which is where I intend to be my working directories.

Re: [Tutor] Questions (and initial responses) on using version control: Why cannot I push my single (master) branch to origin without an error occurring?

2015-04-30 Thread boB Stepp
I created my remote repository on, say my C-drive, with "git init". I then copied and pasted a file to that location and put it under version control with "git add filename.py". Next I went to my E-drive, which is where I intend to be my working directories. After setting up a similar directory str

Re: [Tutor] Questions (and initial responses) on using version control [Was: Introductory questions on test-driven development and implementing Git version control.]

2015-04-25 Thread boB Stepp
On Sat, Apr 25, 2015 at 10:30 AM, boB Stepp wrote: > On Fri, Apr 24, 2015 at 7:36 PM, Steven D'Aprano wrote: >>On Fri, Apr 24, 2015 at 02:09:45PM -0500, boB Stepp wrote: > > [...] > >>> And what would be the best approach to integrating Git with these >>> efforts? Just how often does one commit on

Re: [Tutor] Questions (and initial responses) on using version control [Was: Introductory questions on test-driven development and implementing Git version control.]

2015-04-25 Thread Alan Gauld
On 25/04/15 16:30, boB Stepp wrote: And what would be the best approach to integrating Git with these efforts? Just how often does one commit one's code to the version control system? Or do I have some GCEs (Gross Conceptual Errors) here? Going back to first principles. What is often called Ve

Re: [Tutor] Questions Regarding ASPECT ORIENTED PROGRAMMING (AOP)

2015-02-25 Thread Alan Gauld
On 25/02/15 13:00, Mishal Chowdhury wrote: First, I'm not sure that either of these questions have to do with Aspect Oriented Programming per se. Note however that Python does not offer any specific support for AOP. (You can't explicitly define an 'Aspect' like you can a class for example) 1

Re: [Tutor] questions when define a class

2014-04-15 Thread Peter Otten
Qianyun Guo wrote: > Hi all, I am trying to get a suffix tree from a string. I use three > classes, Node, Edge, SuffixTree. I have two questions when implementing: > > 【1】 > a = Edge(1,2,3,4) > a.length > > 1 > if I remove '@property' in my code, it returns as below: > a = Edg

Re: [Tutor] Questions about classes

2012-11-13 Thread Steven D'Aprano
On 14/11/12 09:50, Ciaran Mooney wrote: Hi, Was hoping someone could help me. I have downloaded the latest pygame 1.9.1 i think) to a Mac powerbook OS 10.4.11. What does this question have to do with classes? When starting a brand new discussion, start with a brand new email thread: * do NOT

Re: [Tutor] Questions about classes

2012-11-13 Thread Ciaran Mooney
Hi, Was hoping someone could help me. I have downloaded the latest pygame 1.9.1 i think) to a Mac powerbook OS 10.4.11. Python 3 does not recognise pygame although python 2.7 version does (unfortunately have never programmed python 2.7 and don't no how). Any help would be much appreciated. T

Re: [Tutor] Questions about classes

2012-11-13 Thread Steven D'Aprano
On 13/11/12 13:49, brandon w wrote: 1. I saw in the book an assignment written like this: class HumanBeing: def makeName(self, name): *self.name = name* * * Why is it not written like this?: class HumanBeing: def makeName(self, name): * na

Re: [Tutor] Questions about classes

2012-11-13 Thread Alan Gauld
On 13/11/12 02:49, brandon w wrote: class HumanBeing: def makeName(self, name): * self.name = name * * Why is it not written like this?: class HumanBeing: def makeName(self, name): * name = self.name Because they two completely different things :

Re: [Tutor] Questions about classes

2012-11-13 Thread Dave Angel
On 11/12/2012 09:49 PM, brandon w wrote: > I have been trying to understand classes. I have been studying from a book > I picked up recently. > I have two questions about them. > > 1. I saw in the book an assignment written like this: > > class HumanBeing: > def makeName(self, name): >

Re: [Tutor] Questions about classes

2012-11-12 Thread R. Alan Monroe
> 2. Why use a class in the first place? What is the purpose of > constructing a class instead of just writing a program with a bunch > of functions? Sometimes, you DO just write programs with functions. A class can be useful if you have a bunch of a thing. Like a monster. Each monster can know

Re: [Tutor] Questions about classes

2012-11-12 Thread Mark Lawrence
On 13/11/2012 02:49, brandon w wrote: I have been trying to understand classes. I have been studying from a book I picked up recently. I have two questions about them. 1. I saw in the book an assignment written like this: class HumanBeing: def makeName(self, name): *

Re: [Tutor] Questions Regarding Sockets

2012-04-15 Thread Khalid Al-Ghamdi
Thanks a lot. You've been, as usual, very helpful. On Sat, Apr 14, 2012 at 8:32 PM, Alan Gauld wrote: > On 14/04/12 17:41, Khalid Al-Ghamdi wrote: > > 1- In line (15), what are these variables tcpCliSock,addr supposed to >> hold and do? >> > > The socket object and the IP address of the client t

Re: [Tutor] Questions Regarding Sockets

2012-04-14 Thread Alan Gauld
On 14/04/12 17:41, Khalid Al-Ghamdi wrote: 1- In line (15), what are these variables tcpCliSock,addr supposed to hold and do? The socket object and the IP address of the client that is connecting to the server. When a client connects to a server the server assigns a new temporary socket conn

Re: [Tutor] Questions Regarding Sockets

2012-04-14 Thread Bod Soutar
On 14 April 2012 17:41, Khalid Al-Ghamdi wrote: > Hi All, > > (python 3.2 on windows) > > I have a couple of questions regarding the below code: > > 1- In line (15), what are these variables tcpCliSock, addr supposed to > hold and do? > 2- Why do I have to specify the buffer size and what does it

Re: [Tutor] questions on encoding

2011-07-20 Thread Steven D'Aprano
Albert-Jan Roskam wrote: Hi, I am looking for test data with accented and multibyte characters. I have found a good resource that I could use to cobble something together (http://www.inter-locale.com/whitepaper/learn/learn-to-test.html) but I was hoping somebody knows some ready resource. I

Re: [Tutor] Questions regarding strings

2010-08-09 Thread Jerry Hill
On Sun, Aug 8, 2010 at 1:04 PM, Daniel wrote: > > Can someone please explain this to me? Thank you so much and I wish everyone > a great day! Beyond what Hugo mentioned in his message, take a look at the tutorial: http://docs.python.org/tutorial/introduction.html#strings I don't see a way to di

Re: [Tutor] Questions regarding strings

2010-08-08 Thread Hugo Arts
On Sun, Aug 8, 2010 at 12:04 PM, Daniel wrote: > Hello everyone! I would like to ask you two questions regarding strings > which I do not know. Excuse me in advance if the questions may seem a bit > dumb. I'm a beginner. So let's get back to the point, this is my string: > > msg= 'Hello world' > I

Re: [Tutor] Questions about the new turtle module in Python 2.6b2

2008-08-15 Thread Gregor Lingl
Hi Dick, as I promised some days ago, here is an event driven version of a rectangle generator, which is based on my first example: from turtle import * from random import random, randint from time import sleep MAXLEN = 30 MAXWID = 25 def randomcolor(): return random(), random(), random() d

Re: [Tutor] Questions about the new turtle module in Python 2.6b2

2008-08-10 Thread Dick Moores
At 11:57 PM 8/9/2008, you wrote: Dick Moores schrieb: Gregor, 1. I want the window to open with the right edge 0 pixels from the right edge of my screen. However, setup(width=.75, height=.915, startx=-0, starty=0) doesn't work. I h

Re: [Tutor] Questions about the new turtle module in Python 2.6b2

2008-08-09 Thread Gregor Lingl
Dick Moores schrieb: At 03:12 AM 8/9/2008, Dick Moores wrote: 4. For my random_rectangles.py program I've started to try out the new turtle. (See the current state of random_rectanglesV16_web.py at < http://py77.python.pastebin.com/d3e842821>.)

Re: [Tutor] Questions about the new turtle module in Python 2.6b2

2008-08-09 Thread Dick Moores
At 03:12 AM 8/9/2008, Dick Moores wrote: 4. For my random_rectangles.py program I've started to try out the new turtle. (See the current state of random_rectanglesV16_web.py at < http://py77.python.pastebin.com/d3e842821>.) The only downside I've found is that the new turtle is much faster that

Re: [Tutor] Questions about wxEvents

2007-12-06 Thread Marc Tompkins
Hot diggety! Exactly what I was trying to come up with. Thank you! On Dec 6, 2007 9:38 AM, Jeff Younker <[EMAIL PROTECTED]> wrote: > While I can't help you with the wx specific part of the question, I canoffer > help with the reuse question. Here is one approach. Add an > controller identi

Re: [Tutor] Questions about wxEvents

2007-12-06 Thread Tiago Saboga
On Thu, Dec 06, 2007 at 09:12:59AM -0800, Marc Tompkins wrote: > I have a specific question - how can I generalize a > FileBrowseButtonWithHistory - and I realized, as I was trying to word my > question, that my real question is a bit more generic. > > First, the specific question: The FileBrowse

Re: [Tutor] Questions about wxEvents

2007-12-06 Thread Jeff Younker
While I can't help you with the wx specific part of the question, I can offer help with the reuse question. Here is one approach. Add an controller identifier to fpCallback. Then use lambda expressions for the actual callback, where the lambda expressions pass in a fixed value for the i

Re: [Tutor] questions about previous emails

2007-10-05 Thread Alan Gauld
"Fangwen Lu" <[EMAIL PROTECTED]> wrote > I wonder whether there is a way for searching for previous questions > and answers so that I don't need to ask simple questions to > overload the message flows. There are at leasty 3 archives, two of which are searchable. The official archive on the Pyho

Re: [Tutor] questions about previous emails

2007-10-05 Thread Eric Brunson
Fangwen Lu wrote: > Dear all- > > I am a new-comer to [EMAIL PROTECTED] I guess a lot of my future > questions may have been asked by others already. > > As I am a new-comer, I don't have the previous emails. > > I wonder whether there is a way for searching for previous questions > and answers

Re: [Tutor] questions about tuples

2007-09-30 Thread Alan Gauld
"Fangwen Lu" <[EMAIL PROTECTED]> wrote > I want to do some loops. Each loop will generate a tuple. Eventually > I want > to put tuples together in a higher level of tuple. Do you know how > to do > this? Inaddition to other replies, you might be able to use a generator expression to do it in o

Re: [Tutor] questions about tuples

2007-09-30 Thread Noufal Ibrahim
Fangwen Lu wrote: > Dear all- > > I want to do some loops. Each loop will generate a tuple. Eventually I > want to put tuples together in a higher level of tuple. Do you know how > to do this? > > Say a=(1,2,3), b=(4,3,2),c=(9,5,6). I want to get a tuple as ((1,2,3), > (4,3,2),(9,5,6)). >

Re: [Tutor] questions about tuples

2007-09-27 Thread Rikard Bosnjakovic
On 26/09/2007, Eric Brunson <[EMAIL PROTECTED]> wrote: > You can't use append() on a tuple, because a tuple is, by design, immutable. Yes, and that's why he appends to a list, then converts the list to a tuple. -- - Rikard - http://bos.hack.org/cv/ _

Re: [Tutor] questions about tuples

2007-09-26 Thread Eric Brunson
Fangwen Lu wrote: > Dear all- > > I want to do some loops. Each loop will generate a tuple. Eventually I > want to put tuples together in a higher level of tuple. Do you know > how to do this? > > Say a=(1,2,3), b=(4,3,2),c=(9,5,6). I want to get a tuple as ((1,2,3), > (4,3,2),(9,5,6)). >

Re: [Tutor] questions about tuples

2007-09-26 Thread Ricardo Aráoz
Fangwen Lu wrote: > Dear all- > > I want to do some loops. Each loop will generate a tuple. Eventually I > want to put tuples together in a higher level of tuple. Do you know how > to do this? > > Say a=(1,2,3), b=(4,3,2),c=(9,5,6). I want to get a tuple as ((1,2,3), > (4,3,2),(9,5,6)). > > I

Re: [Tutor] Questions about easygui and compiling

2007-06-08 Thread Rafael Bejarano
Thanks. I'll definitely try out your instructions. Rafael On Jun 8, 2007, at 4:21 PM, Gordon wrote: > Yes, I can. But first, make sure to hit"Reply All" to send replies > to the list, rather than just me :) > > Anyhow, there are a couple ways, but I think the easiest is to make > a one-line

Re: [Tutor] Questions about easygui and compiling

2007-06-08 Thread Gordon
Yes, I can. But first, make sure to hit"Reply All" to send replies to the list, rather than just me :) Anyhow, there are a couple ways, but I think the easiest is to make a one-line script that imports the file you want to make a .pyc out of. You'll end up with 3 versions of the file, a .py,

Re: [Tutor] Questions about easygui and compiling

2007-06-08 Thread Alan Gauld
"Rafael Bejarano" <[EMAIL PROTECTED]> wrote > First, I am trying to learn to use easygui to present simple dialogs > and get input from the user. To this end, I wrote a very short test > program, just to make sure I new how to use easygui. Although I get > no error messages when I run it, the dia

Re: [Tutor] Questions about easygui and compiling

2007-06-07 Thread Gordon
I have no experience with EasyGUI, but to answer your other question, you do not "compile" Python in the way you compile C or Java. Python can be compiled into a .pyc file, which is slightly faster to start running and obfuscates the source, but it doesn't really do much, practically. You can

Re: [Tutor] Questions of Maths

2007-04-19 Thread Abu Ismail
Thank you very much guys, this has been most helpful. At the moment I run the program as Alan suggests. However, the goal is to incorporate the program into Glade2 GUI and I am not sure that it will work with Tk, although I must admit I have not tried it out yet. Abu Ismail On 4/18/07, János Juh

Re: [Tutor] Questions of Maths

2007-04-18 Thread János Juhász
Hi Abu, > Question: how to determine whether point C is to the left or to the > right of the line AB? When the line given by A(Xa,Ya) and B(Xb, Yb), the area of the A-B-C triangle can be calculated with the value of next determinant / 2 | Xa, Ya, 1 | | Xb, Yb, 1 | | Xc, Yc, 1 | / 2 So: Area =

Re: [Tutor] Questions of Maths

2007-04-18 Thread Alan Gauld
"Abu Ismail" <[EMAIL PROTECTED]> wrote > I am working on an implementation of an L-system in Python. I hate > using turtle module since it uses Tk and as my IDE also uses Tk I > have > to close my editor before I can test the program. Why so? Don''t you have a multi-tasking OS? If so just run a

Re: [Tutor] Questions of Maths

2007-04-18 Thread Andre Roberge
On 4/18/07, Abu Ismail <[EMAIL PROTECTED]> wrote: > Hi, > > I am working on an implementation of an L-system in Python. I hate > using turtle module since it uses Tk and as my IDE also uses Tk I have > to close my editor before I can test the program. So I am implementing > the graphics using PIL.

Re: [Tutor] Questions about PIL

2006-11-09 Thread Luke Paireepinart
Chris Hengge wrote: > Yes, I understand what a loop is, and there was a loop but I didn't > write that code into my email because I didn't need commenting on it. > Here is the code so its clear incase you really care =P Just because you don't need commenting on it doesn't mean it's not relevant. E

Re: [Tutor] Questions about PIL

2006-11-09 Thread Luke Paireepinart
Chris Hengge wrote: > What I want to do with the data shouldn't really matter. I'm not > completely sure what I want to do with the image data anyways, but for > sake of arguement everything is happening in memory at this point, so > 'objects' is correct. Images start in memory, and are being ev

Re: [Tutor] Questions about PIL

2006-11-09 Thread Kent Johnson
Chris Hengge wrote: > alist = difference(image1,image2) > a = [b for b in alist.getdata() if b != (0,0,0)] > if len(a) != 0: >print "Not the same" > > is much slower then (9x) > > if im1.tostring() != im2.tostring() >print "something changed!" One reason the second version will be fa

Re: [Tutor] Questions about PIL

2006-11-09 Thread Chris Hengge
What I want to do with the data shouldn't really matter. I'm not completely sure what I want to do with the image data anyways, but for sake of arguement everything is happening in memory at this point, so 'objects' is correct. Images start in memory, and are being evaluated in memory, never writte

Re: [Tutor] Questions about PIL

2006-11-09 Thread Chris Hengge
Yes, I understand what a loop is, and there was a loop but I didn't write that code into my email because I didn't need commenting on it. Here is the code so its clear incase you really care =Pfrom PIL import Image from PIL import ImageGrabimport timecapturedFrames = 100count = 0print "\nInitializi

Re: [Tutor] Questions about PIL

2006-11-08 Thread Luke Paireepinart
Chris Hengge wrote: > Thanks for the detailed examples again Luke. Sorry I wasn't more clear > with my implimentation. The loop I was refering to was the one in the > start of my post but using im.tostring() instead. I saw an example to > make a webcam motion detector that used tostring(), but c

Re: [Tutor] Questions about PIL

2006-11-08 Thread Luke Paireepinart
Chris Hengge wrote: > alist = difference(image1,image2) > a = [b for b in alist.getdata() if b != (0,0,0)] > if len(a) != 0: >print "Not the same" > > is much slower then (9x) > > if im1.tostring() != im2.tostring() >print "something changed!" > > This loop itself is fairly slow by itse

Re: [Tutor] Questions about PIL

2006-11-08 Thread Chris Hengge
alist = difference(image1,image2)a = [b for b in alist.getdata() if b != (0,0,0)]if len(a) != 0:    print "Not the same"is much slower then (9x)if im1.tostring() != im2.tostring()   print "something changed!" This loop itself is fairly slow by itself though.. I'm going to try and see if there i

Re: [Tutor] Questions about PIL

2006-11-08 Thread Chris Hengge
I tried the .tostring again, seems to be working using != instead of is not... Thanks for that thread link, very helpful. I'll look more into im.transform and see what I can come up with. I'm not sure I fully understand what it does, but I'm reading it as I'll remove the wanted section of im and tr

Re: [Tutor] Questions about PIL

2006-11-08 Thread Chris Hengge
Thanks for the detailed examples again Luke. Sorry I wasn't more clear with my implimentation. The loop I was refering to was the one in the start of my post but using im.tostring() instead. I saw an example to make a webcam motion detector that used tostring(), but couldn't get the program to see

Re: [Tutor] Questions about PIL

2006-11-08 Thread Danny Yoo
On Wed, 8 Nov 2006, Chris Hengge wrote: > I'm trying to figure out how to compare im1 to im2 and recognize the > difference. I dont care what the difference is... > > something like > > if im1 is not im2: >print "Not same" Do not use 'is' here. It is not doing any kind of equality testing

Re: [Tutor] Questions about PIL

2006-11-08 Thread Luke Paireepinart
Chris Hengge wrote: > I'm trying to figure out how to compare im1 to im2 and recognize the > difference. I dont care what the difference is... > > something like > > if im1 is not im2: > print "Not same" Hey, Chris. I'm supposing here that you are checking if the images are _visually_ differ

Re: [Tutor] Questions on file.read

2005-07-14 Thread Alan G
> Notice that when in non-blocking mode, less data than what was > requested > may be returned, even if no size parameter was given. > > What does "blocking-mode" mean, Its easier to answer by explaining blocking mode. In blocking mode the read will wait(block) until size bytes are available. Thi

Re: [Tutor] Questions on file.read

2005-07-14 Thread Kent Johnson
Max Noel wrote: > In any cas, you should try to avoid using file.read without a size > parameter. If you're processing text files, reading them one line at a > time would be a good start (for line in open ('filename.txt'): is an > instance of Best Thing Ever). Yes, this is good advice, if

Re: [Tutor] Questions on file.read

2005-07-14 Thread Max Noel
On Jul 14, 2005, at 12:26, Negroup - wrote: "To read a file's contents, call f.read(size), which reads some quantity of data and returns it as a string. size is an optional numeric argument. When size is omitted or negative, the entire contents of the file will be read and returned; it's your p

Re: [Tutor] Questions on file.read

2005-07-14 Thread Kent Johnson
Negroup - wrote: > read(...) > read([size]) -> read at most size bytes, returned as a string. > > If the size argument is negative or omitted, read until EOF is reached. > Notice that when in non-blocking mode, less data than what was requested > may be returned, even if no size pa