web camera or else ? 15-30 fps processing of camera videos.

2005-02-01 Thread Newbie
I am doing some robotics projects but my main area of interest is
trying out several algorithms for the processing of the stream of data
coming from the video.

I am wondering what type of camera I should invest in. Either I could
buy a web cam and hope I can find a driver I could either modify or
use. i.e. every frame is somehow stored on the computer automagically
or I could buy a camera not unlike the AVRcam
(http://www.jrobot.net/Projects/AVRcam.html) or the CMUcam and try to
do the processing once the data has been streamed to the nearest
computer ? or should I use an expensive video card, some CCTV camera
and a frame grabber to digitize photos so they can be processed
afterwards. I expect my processing algorithms to handle at least 15
frames per second framerate once they are working ont the final set-up.

My constraints are that I would like to avoid as much as possible
complex set-ups even if that means buying a more expensive camera
set-up. For the prototyping, I would like to try my algorithms out
using a combination of python and matlab (all very slow) and then
expect the same architecture (image files location and flow) with
speedier set-up like python+psyco or C. All the processing would be
done on a computer dedicated for that. Windows or Linux are possible.

Any help from either comp.robotics.misc or c.l.p would be helpful.
Thanks in advance,

Jake.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: web camera or else ? 15-30 fps processing of camera videos.

2005-02-02 Thread Newbie
Folks:

here is a small summary:

For Linux based system, xawt seems to be the solution:
http://linux.bytesex.org/xawtv/
where one can get access to the stream from any device that has a video
output.

For win32, it looks like the solution is this:
http://videocapture.sourceforge.net/
where one has to use the python programming language.

Great help, thank you all,

Jake.


Matt D wrote:
> Newbie wrote:
> > I am doing some robotics projects but my main area of interest is
> > trying out several algorithms for the processing of the stream of
data
> > coming from the video.
>
> 
>
> Same for me!  From what I can tell, a cheap webcam will "just work"
with
> a recent version of windows - i.e. plug it in using USB and then you
can
> have programmatic access to the data and grab frames very easily.
This
> setup works fine with my digital camera working as a webcam - real
£10
> webcams should be the same.  Not sure what Linux compatibility is
like
> these days - for that I know for a fact that the Hauppauge USB WinTV
> thing works (or at least the hardware version I have works) with
Linux.
>
> For linux I found this (now on the wayback archive - original page is

> now 404):
>
http://web.archive.org/web/20020322015936/http://staff.aist.go.jp/naoyuki.ichimura/research/tips/v4ln_e.htm
>
> Hopefully that is some help.
>
> Oh by the way, speed on a modern machine shouldn't be an issue - my
> badly written prototype in visual basic of all things (dont laugh -
> seemed like a good idea at the time!) was tracking a single coloured
> object reliably at significantly greater than 30fps (it automatically

> altered the window it searched in based on size and amount of
movement
> of the object - at times it was approaching 100fps) on a modest by
> today's standards 1.4ghz pc, using a 320x240 stream.

--
http://mail.python.org/mailman/listinfo/python-list


use embedded python to build a dll

2004-12-07 Thread newbie
Hi all,
I got a problem using the embedded python. I'll be appreciated if some one
can show me the way.

What i want is,
1.build a dll(test.dll/test.lib) which uses the embedded python, for
example, i want to use the 're' module.
2.build a exe(usedll.exe) which uses that dll.
3.use py2exe to eliminate the dependence of the python environment.

here is the cpp file to build test.dll/test.lib

**query.py is the python script i used. so i import the module 'query'**


#include "stdafx.h"
#include 
#pragma comment(lib, "d:sdk\\Python23\\libs\\python23.lib")
#include "d:\sdk\python23\include\python.h"

BOOL APIENTRY DllMain( HANDLE hModule,
   DWORD  ul_reason_for_call,
   LPVOID lpReserved
  )
{
return TRUE;
}


__declspec(dllexport) void __stdcall DoIt()
{
 Py_Initialize();
 PyObject *pM=PyImport_ImportModuleEx("query", NULL, NULL, NULL);
  Py_XDECREF(pM);
 std::cout<<"ok";
 Py_Finalize();
}


here is the file to build usedll.exe


#include "stdafx.h"
#include "windows.h"

#pragma comment(lib, "..\\Release\\test.lib")

__declspec(dllimport) void __stdcall DoIt();
int main(int argc, _TCHAR* argv[])
{
 DoIt();

 return 0;
}




i use setup.py file like this,

from distutils.core import setup
import py2exe
setup()

and then
python setup.py py2exe --includes query --packages encodings

and i got a bunch of files.

Then I put usedll.exe test.dll test.lib query.py and all of these files
generated by py2exe in the same directory. I run the usedll.exe, then I got
a run time error 'this application has requested the runtime to terminate it
in an unusual way...'

but if i don't use those files generated by py2exe, i.e. i use the python
environment on my machine, every thing is fine.

I can not figure out where is the problem. Could anyone give me a hint?


-- 
http://mail.python.org/mailman/listinfo/python-list


newbie question about python and Tkinter

2005-12-11 Thread newbie
Hello,

I am a newbie and have a few questions about Python and Tkinter.

I would like to create the following layout in Python:

***
* *
* *
* *
* frame 1 *
* *
* *
* *
* *
***
*   * *
*   * *
*   * *
*frame 3*  frame 2*
*   * *
*   * *
*   * *
***

I try to accomplish this with the following code:

from Tkinter import *

root = Tk()
root.title("Critter World")

MyFrame0 = Frame(root, background="brown")  # One Parent Frame to rule
them all

MyFrame1  = Frame(MyFrame0, background = "yellow")
MyFrame2  = Frame(MyFrame0, background = "red")
MyFrame3  = Frame(MyFrame0, background = "green")

b1 = Label(MyFrame1, text="World", background="yellow").pack(fill=BOTH,
expand=YES)
b2 = Label(MyFrame2, text="Info", background="red").pack(fill=BOTH,
expand=YES)
b3 = Label(MyFrame3, text="Control",
background="green").pack(fill=BOTH, expand=YES)

MyFrame1.pack(side=TOP, fill=BOTH, expand=YES)
MyFrame2.pack(side=RIGHT, fill=BOTH, expand=YES)
MyFrame3.pack(side=LEFT, fill=BOTH, expand=YES)

MyFrame0.pack(fill=BOTH, expand=YES)
raw_input()
print "\n"*23

When the window resizes, it is only Frame1 that is resized.




However, if I run the following:



from Tkinter import *

root = Tk()
root.title("Critter World")

MyFrame0 = Frame(root, background="brown")  # One Parent Frame to rule
them all

MyFrame1  = Frame(MyFrame0, background="yellow")
MyFrame2  = Frame(MyFrame0, background = "red")
MyFrame3  = Frame(MyFrame0, background = "green")
MyFrame4  = Frame(MyFrame0, background = "black")


b1 = Label(MyFrame1, text="World", background="yellow").pack(fill=BOTH,
expand=YES)
b2 = Label(MyFrame2, text="Info", background="red").pack(fill=BOTH,
expand=YES)
b3 = Label(MyFrame3, text="Control",
background="green").pack(fill=BOTH, expand=YES)
b4 = Label(MyFrame3, text="NEXT 1", background="green").pack(fill=BOTH,
expand=YES)


MyFrame1.pack(side=TOP, fill=BOTH, expand=YES)
MyFrame2.pack(side=RIGHT, fill=BOTH, expand=YES)
MyFrame3.pack(side=LEFT, fill=BOTH, expand=YES)
MyFrame4.pack(side=BOTTOM, fill=BOTH, expand=YES)

MyFrame0.pack(fill=BOTH, expand=YES)
raw_input()
print "\n"*23

I get:

***
* *
* *
* *
* frame 1 *
* *
* *
* *
* *
* *
* *
* *
* *
* *
***
*   * *
*   * *
*frame 3* *
*   * *
*   * *
*  frame 2*
*   * *
*   * *
*frame 4* *
*   * *
*   * *
***

and when I resize, all frames are resized?

Any idea why?


A related question:

Why does frame 4 not span the bottom ?

i.e.

***
* *
* *
* *
* frame 1 *
* *
* *
* *
* *
* *
* *
* 

Global Variables in OOP and Python

2005-12-30 Thread newbie
Hello,

I have questions about global variables in OOP (in general) and Python
(in specific).  I understand (I think) that global variables are
generally not a good idea. However, if there are variables that need to
be accessed by a number of classes that exists in separate namespaces
(files), what would be the best way to do this?

So far, I have approached the problem by making the variables
attributes of one class and passing instances of the class as variables
to the other class' methods.

The other way I thought of is to create a separate class that consists
of the variables and to use the

from  import *

in all of the files (namespaces) where it is needed.

Is there a better way?

Are the two ideas presented above acceptable? If so, is one better than
the other from an OOP POV?

-- 
http://mail.python.org/mailman/listinfo/python-list


Is Python what I need?

2009-08-23 Thread newbie
Hi all
I'm interested in developing computer based, interactive programs for
students in a special school who have an aversion to pen and paper.
I've searched the net to find ready made software that will meet my
needs but it is either written to a level much higher than these
students can cope with or priced beyond our school budget. I came
across a blog of someone singing the praises of Python. My question is
therefore aimed at those that know what they are talking about (ie
users in this group). Is Python the language I need to learn to
develop these programs?
-- 
http://mail.python.org/mailman/listinfo/python-list


Help me with the script? How to find items in csv file A and not in file B and vice versa

2013-06-18 Thread Alan Newbie
Hello,
Let's say I want to compare two csv files: file A and file B. They are both 
similarly built - the first column has product IDs (one product per row) and 
the columns provide some stats about the products such as sales in # and $.

I want to compare these files - see which product IDs appear in the first 
column of file A and not in B, and which in B and not A.
Finally, it would be very great if the result could be written into two new CSV 
files - one product ID per row in the first column. (no other data in the other 
columns needed)

This is the script I tried:
==

import csv

#open CSV's and read first column with product IDs into variables pointing to 
lists
A = [line.split(',')[0] for line in open('Afile.csv')]
B = [line.split(',')[0] for line in open('Bfile.csv')]

#create variables pointing to lists with unique product IDs in A and B 
respectively 
inAnotB = list(set(A)-set(B))
inBnotA = list(set(B)-set(A))

print inAnotB
print inBnotA

c = csv.writer(open("inAnotB.csv", "wb"))
c.writerow([inAnotB])


d = csv.writer(open("inBnotA.csv", "wb"))
d.writerow([inBnotA])

print "done!" 

=

But it doesn't produce the required results.
It prints IDs in this format:
247158132\n

and nothing to the csv files.

You could probably tell I'm a newbie.
Could you help me out?

here's some dummy data:
https://docs.google.com/file/d/0BwziqsHUZOWRYU15aEFuWm9fajA/edit?usp=sharing

https://docs.google.com/file/d/0BwziqsHUZOWRQVlTelVveEhsMm8/edit?usp=sharing

Thanks a bunch in advance! :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help me with the script? How to find items in csv file A and not in file B and vice versa

2013-06-18 Thread Alan Newbie
thanks a lot :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Idiots guide to fonts with tKinter

2005-08-04 Thread import newbie
Hi all,

I'm a programming dabbler trying learn Python, and I've got a few
questions.

Mainly: Where can I find a good open-source library or tutorial
(preferably free) that explains how to easily manipulate text in a
tKinter window? Basically, I want to be able to do anything that HTML
can do (or close to it) but without the HTML. :-)

My "newbie dream project" is to piece together a functional, WYSIWYG
text editor that can handle at least three fonts: Times New Roman,
Arial and Courier (bold, italics and underlined).

I know, I know. That's pretty ambitious. But that's my goal for Python.
Sowhat's the easiest way to get there? What steps should I take?
I'm not in any rush, I just want some help along the way...

-- 
http://mail.python.org/mailman/listinfo/python-list


Does FTPLIB have a 'local change directory' ?

2005-08-06 Thread python newbie
Hi, first I wanted to say that:

 I have finally been able to ftp a file in my python app -  however, it 
works like this:

 When you use storbinary and hand it a full path 
"c:\myfiles\morefiles\picture.gif"..
 it will find the file on your hard drive, and
then upload the file,  but on the ftp server, it literally names the file:

"c:\myfiles\morefiles\picture.gif"


I'd like to be able to first

  ftplib.lcd( "c:\myfiles\morefiles"  )

 and then just

storbinary( picture.gif .. ).

But the python doc doesn't show any LCD.

Or am I going to have to be satisfied with having to just use a rename on 
the server,
after uploading the file?

Thanks
Steve





 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OS env for Windows

2005-02-13 Thread python newbie
Cool thanks a lot. Always wanted to use win32api module too.
"Tony Meyer" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>> Is there any other way
>> of distinguishing between XP and 2000 I wonder?
>
> WinXP SP2:
>
 import win32api
 major, minor, spack, platform, ver_str = win32api.GetVersionEx()
 print major, minor, spack, platform, ver_str
> 5 1 2600 2 Service Pack 2
>
> WinNT SP4:
>
 import win32api
 major, minor, spack, platform, ver_str = win32api.GetVersionEx()
 print major, minor, spack, platform, ver_str
> 5 0 2195 2 Service Pack 4
>
> =Tony.Meyer
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Harvestman install not working

2005-04-06 Thread python newbie
Hi, I previously had Harvestman installed and working okay, but somehow the
latest version won't install.

I have Python23 installed.

When I attempt to execute the py2exesetup.bat file (on Windows XP), I get:

--

E:\zips\internet\utilities\HarvestMan-1.4\HarvestMan-1.4.tar\HarvestMan-1.4\Harv
estMan>rem Batch file for creating py2exe executable for Harvestman
usage: install.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: install.py --help [cmd1 cmd2 ...]
   or: install.py --help-commands
   or: install.py cmd --help

error: option --force-imports not recognized
Press any key to continue . . .


--

Any suggestions?
 Thanks



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Harvestman install not working

2005-04-06 Thread python newbie
Thanks Anand, (both for Harvestman and for the reply.)
By the way, I did try that, so that the command is:

c:\python23\python.exe install.py py2exe -O2 --packages=encodings

And this time the dist folder was created, but there were only these files 
in there:

library.zip
python23.dll
unicodedata.pyd
w9xpopen.exe
zlib.pyd
_sre.pyd

I'll keep trying though.


"Anand" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi
>
>Latest version of py2exe does not support the option
> --force-imports anymore I think. You can edit the .bat file to remove
> that option. It should work.
>
> -Anand
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Harvestman install not working

2005-04-06 Thread python newbie
Thanks Anand, (both for writing Harvest,  and for the reply.)
By the way, I did try that, so that the command is:

c:\python23\python.exe install.py py2exe -O2 --packages=encodings

And this time the dist folder was created, but there were only these files
in there:

library.zip
python23.dll
unicodedata.pyd
w9xpopen.exe
zlib.pyd
_sre.pyd

I'll keep trying though.


"Anand" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
>Latest version of py2exe does not support the option
> --force-imports anymore I think. You can edit the .bat file to remove
> that option. It should work.
>
> -Anand
>



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Harvestman install not working

2005-04-06 Thread python newbie
Thanks Anand, (both for writing Harvest,  and for the reply.)
By the way, I did try that, so that the command is:

c:\python23\python.exe install.py py2exe -O2 --packages=encodings

And this time the dist folder was created, but there were only these files
in there:

library.zip
python23.dll
unicodedata.pyd
w9xpopen.exe
zlib.pyd
_sre.pyd

I'll keep trying though.





"Anand" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi
>
>Latest version of py2exe does not support the option
> --force-imports anymore I think. You can edit the .bat file to remove
> that option. It should work.
>
> -Anand
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Harvestman install not working

2005-04-06 Thread python newbie
Thanks Anand, (both for writing Harvest,  and for the reply.)
By the way, I did try that, so that the command is:

c:\python23\python.exe install.py py2exe -O2 --packages=encodings

And this time the dist folder was created, but there were only these files
in there:

library.zip
python23.dll
unicodedata.pyd
w9xpopen.exe
zlib.pyd
_sre.pyd

I'll keep trying though.


"Anand" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
>Latest version of py2exe does not support the option
> --force-imports anymore I think. You can edit the .bat file to remove
> that option. It should work.
>
> -Anand
>



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Harvestman install not working

2005-04-06 Thread python newbie
First of all, please disregard the extra posts, Anand, I need to really 
really get a new newsreader.  It kept on giving me an error, making me think 
that each sendbutton click wasnt' working.

 My mistake, I use the Harvestman.Py in the main folder, of course.

It works fine.
 Thanks again.

"Anand" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi
>
>Latest version of py2exe does not support the option
> --force-imports anymore I think. You can edit the .bat file to remove
> that option. It should work.
>
> -Anand
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Is Python Right for Me?

2007-02-02 Thread Mister Newbie
I want to make small, 2D games. I have no programming experience. Is Python 
a good choice?

Thank you. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python Right for Me?

2007-02-02 Thread Mister Newbie
"Terry Reedy" <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]: 

> 
> "Mister Newbie" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
>|I want to make small, 2D games. I have no programming experience. Is 
> Python
>| a good choice?
> 
> Possibly.  There is an add-on package called pygame that is, I
> believe, 2d oriented.  See www.pygame.org
> There is also an associated mailing list, which you can also read via 
> news.gmane.org as newsgroup gmane.comp.python.pygame.
> 
> tjr 
> 
> 
> 
> 

Thanks for the reply. I'll check it out.
-- 
http://mail.python.org/mailman/listinfo/python-list


Where Does One Begin?

2007-02-02 Thread Mister Newbie
I have no programming experience. I want to learn Python so I can make 
simple, 2D games. Where should I start? Can you recommend a good book?

Thank you.

-- 
http://mail.python.org/mailman/listinfo/python-list


Mailing list question

2008-04-16 Thread python newbie
Hello,
Just curious; can I post a basic programming question to this mailing list?

Thanks  in advance.

Pete

   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.-- 
http://mail.python.org/mailman/listinfo/python-list

Logical Operator and code block not executing (newbie question)

2008-04-16 Thread python newbie
Hello,
I am running into a small problem of not having a code block not executing 
after after a logical operator is true.   What am I missing or doing wrong.  
Any thoughts or opinions would be greatly appreciated.  

The  block that isn't being executed follows:

 elif (guess == the_number) and (tries < total_attempts):

print "You guessed it! The number was", the_number
print "And it only took you", tries, "tries!\n"
print "The  correct answer is: ", the_number

Below is the complete script:
#! /usr/bin/python
# Aurthor: Me
# Purpose: Demonstrates
# Date: April 15, 2008

import random

print "\tWelcome to 'Guess My Number'!"
print "\nI'm thinking of a number between 1 and 100."
print "Try to guess it in as few attempts as possible.\n"

# set the initial values
the_number = random.randrange(100) + 1
guess = int(raw_input("Take a guess: "))
tries = 1
total_attempts = 3

# guessing loop
while (guess != the_number): 
if (guess > the_number) and (tries < total_attempts):
print "Lower..."
print "You have...", total_attempts - tries, "left."
print "The  correct answer is: ", the_number
elif (guess < the_number) and (tries < total_attempts):
print "Higher..."
print "You have...", total_attempts - tries, "left."
print "The  correct answer is: ", the_number
elif (guess == the_number) and (tries < total_attempts):
print "You guessed it! The number was", the_number
print "And it only took you", tries, "tries!\n"
print "The  correct answer is: ", the_number
elif (tries >= total_attempts):
print "You're out of guess"
print "You have...", total_attempts - tries, "left."
print "You need more practice."
print "The  correct answer is: ", the_number
break
else: 
print "You shouldn't see this message..."
print "You have...", total_attempts - tries, "left."
print "The  correct answer is: ", the_number
break
guess = int(raw_input("Take a guess: "))
tries += 1


raw_input("\n\nPress the enter key to exit.")

PS: I am new to coding & scripting.

Pete


   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.-- 
http://mail.python.org/mailman/listinfo/python-list

Re: listing computer hard drives with python

2008-05-05 Thread python newbie
Sorry, I forgot to copy the list.

Looks like you are doing this on Windows.  Windows has a built in command call 
fsutil that would work in this situation.  The syntax would be:

C:\Documents and Settings\username>fsutil fsinfo drives

Drives: C:\ D:\ E:\

To find out the type of drive you can use:

C:\Documents and Settings\username>fsutil fsinfo drivetype c:

c: - Fixed Drive

On a side note you can call an external command via:

import os
os.system('fsutil fsinfo drives')
os.system('fsutil fsinfo drivetype c:')

I hope this helps.

PS: I am not sure about the privileges  that are required to run fsutil.

Disclaimer: I am new to python and programming.  This may not be they python 
way of doing things.

Pete



Ohad Frand <[EMAIL PROTECTED]> wrote:Hi
  I am looking for a way to get a list of all active logical hard drives of the 
computer (["c:","d:"..])
   
  Thanks,
  Ohad
  
  --
http://mail.python.org/mailman/listinfo/python-list

   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.--
http://mail.python.org/mailman/listinfo/python-list