Re: [Tutor] Catch event's on my computer

2007-06-23 Thread Alan Gauld
"Flaper87" <[EMAIL PROTECTED]> wrote

> I mean, i need to catch every movement of the pointer, what its 
> position is
> everything. I've read that i can do that using my native system API, 
> and
> also pygame.

I don't know about pyGame but certainly the OS API should allow it.
What OS/GUI are you using? That will make a difference.

If its Windows then the ctypes module will give you access
to the Win32 API. You will need to refer to the Microsoft
documentation to figure out which API calls you need and
how to intercept them.

Its all pretty easy capturing them for your own app, but when
you try to track events outside your app it becomes pretty
low level and depends a lot on the individual OS, so we
can't really give general advice.

> My idea is to do this with a thread. What can you suggest me?

I'm not sure why a thread would help since its event driven.
You should just be able to catch the events as they come
in and update a data store of some kind. If anything I'd expect
the processing of the data store to be more likely running in
a thread.


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 40, Issue 54

2007-06-23 Thread Che M
regarding making an executable file from a python file, Alan Gauld said:

>Assuming you are on Windows you can use py2exe but
>its non trivial to use. (Not hard, just not trivial)
>
>But first ask why you need to.
>I've been using Python for over 10 years now and never once needed
>to do this. (I did it once just to see how, but I've never *needed* to
>do it)
>
>Once Python is installed you can run any script by just double
>clicking in explorer.
>
>And you can build installers that will install python if its not
>already there and then add your script. There are few cases
>where you really need an exe file. IMHO.

Though, yes, you never need to, perhaps you might *want* to, for reasons of 
"marketability".  For example...if I want to make an application for 
distribution to others, either for sale or as freeware, and I use the 
installers option as you mentioned, it is only proper to indicate this to 
the end user, such as, "In installing this application, the Python 
programming language and some other libraries will also be installed on your 
computer."

But that might trigger a common psychological response from the user, "Oh, 
no, not a whole complex set of things installed on my computer that I don't 
understand, have never heard of, and will only need for this one 
application"  But downloading a single .exe file and maybe a small folder of 
images or a few .dll files doesn't conjure that sense.  If I understand it 
right, the .exe has Python bundled into it anyway, so such an end user's 
response isn't strictly rational, but you can see how people might feel this 
way in an age when there are so many ways one should mistrust software.

Another reason is that, as I understand it, making it an .exe obscures the 
code (at least enough to make it take a bit more work to reveal the code).  
For some this might be a benefit?

I may be way off base here, just throwing it out as something I've wondered 
about.

_
Get a preview of Live Earth, the hottest event this summer - only on MSN 
http://liveearth.msn.com?source=msntaglineliveearthhm

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] SPE - Stani's Python Editor ?

2007-06-23 Thread Frank Burden
Hi Dick

I read your post and  wonder if you could mail me a copy of SPE for 
Python 2.5

//SPE-0.8.3.c.win32-py2.5.exe

I'd be most grateful as I've just switched from Python 2.3 to 2.5 and miss 
Stani's lovely editor.

Cheers

Frank

Frank Burden
548 Canning Street
Carlton North 
VIC 3054
Australia
P: +613 9380 9311
F: +613 8611 7960
M: 0408 306 466
e: [EMAIL PROTECTED]
//


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] pyhook for Linux

2007-06-23 Thread Flaper87

Hi!

Does anyone knows an equivalence of pyhook for linux?

I need to catch the events of the mose (even the simple movement, or when it
focus an icon on Desktop), and the events of the keyboard.

Thank's

--
Flavio Percoco Premoli, A.K.A. [Flaper87]
http://www.flaper87.com
Usuario Linux registrado #436538
Geek by nature, Linux by choice, Debian of course.
Key Fingerprint: CFC0 C67D FF73 463B 7E55  CF43 25D1 E75B E2DB 15C7
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] ongoing saga

2007-06-23 Thread Luke Paireepinart
Kirk Bailey wrote:
> well  now. I had a new idea, a product to let managers communicate to
> workteramss in offices- sends messages to groups of people.
>
> My approach is valuable because iit is so simple, and does not requirte the
> opeininig of new ports in the fireewwall of a site- it opperates through
> port 80, the http port. It is very easy to use at bothe ends, and only 1
> program is employed to accomlish it's work.
>
> Now here is  the intresting part- Sellinig it. As offices are so different
> in their setup, using it takes some case by case 'fitting' to apply it to
> each office. A house IT staff can install and adapt it to their situationb
> on their own, or employ our firm to custom install it for them. Therefore,
> we are going to GIVE IT AWAY, but offer support and installation services.
>
> So here's the miravcle of the money tree- we make money by giving it away,
> then letting people pay us to bring a ladder when they dig their own graves.
> It  will become available to the public in a month.
>
> So how's YOUR money tree growing?
I was under the impression that managers e-mailed their workteams if 
they needed to talk to groups of people.
If the people are on an intranet, there shouldn't be any firewalls 
blocking their communication.
The firewall would be between the computers and the internet, correct?

The point of a firewall is to block all traffic which may be harmful to 
computers behind it.
If your software listens on port 80, this is an abuse of the firewall 
spec, IMHO.
The reason people are willing to open port 80 is because they know the 
only thing that will be listening
on the other end is Microsoft IIS or Apache, both applications which 
have been under constant, stable development for years
and have good security.  Putting an application you just wrote from 
scratch with no regard to the security of it provides
hackers an entrypoint into your network via your application.

In addition, I doubt the managers would move to universally supporting 
your application - many of them would desire to continue to use
e-mail for communication - and this would result in the workers having 
just another intrusive application they have to leave open all the time,
as they're already required to leave an e-mail client active, I would guess.

Anyway, I'm just a college kid with no experience in this kind of stuff, 
so if I'm completely wrong then correct me,
but that's how I'd see it as working.

P.S. my money tree's a little dried up right now but I hope with some 
water and some love it'll be rejuvenated soon.
-Luke

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] ongoing saga

2007-06-23 Thread Kirk Bailey
I jujst mounted it in my code website so I can d emo it over the web- using
exactly the same script in a FreeBSD server as my windows 2000 laptop is
using- and it works.

The control station form:
http://www.tinylist.org/podium.html

The user's end view:
http://www.tinylist.org/frametest.html


-- 
Salute!
-Kirk Bailey
   Think
  +-+
  | BOX |
  +-+
   knihT

Fnord.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] ongoing saga

2007-06-23 Thread Kirk Bailey
well  now. I had a new idea, a product to let managers communicate to
workteramss in offices- sends messages to groups of people.

My approach is valuable because iit is so simple, and does not requirte the
opeininig of new ports in the fireewwall of a site- it opperates through
port 80, the http port. It is very easy to use at bothe ends, and only 1
program is employed to accomlish it's work.

Now here is  the intresting part- Sellinig it. As offices are so different
in their setup, using it takes some case by case 'fitting' to apply it to
each office. A house IT staff can install and adapt it to their situationb
on their own, or employ our firm to custom install it for them. Therefore,
we are going to GIVE IT AWAY, but offer support and installation services.

So here's the miravcle of the money tree- we make money by giving it away,
then letting people pay us to bring a ladder when they dig their own graves.
It  will become available to the public in a month.

So how's YOUR money tree growing?

-- 
Salute!
-Kirk Bailey
   Think
  +-+
  | BOX |
  +-+
   knihT

Fnord.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 40, Issue 54

2007-06-23 Thread Luke Paireepinart
Che M wrote:
> regarding making an executable file from a python file, Alan Gauld said:
>
>   
>> Assuming you are on Windows you can use py2exe but
>> its non trivial to use. (Not hard, just not trivial)
>>
>> But first ask why you need to.
>> I've been using Python for over 10 years now and never once needed
>> to do this. (I did it once just to see how, but I've never *needed* to
>> do it)
>>
>> Once Python is installed you can run any script by just double
>> clicking in explorer.
>>
>> And you can build installers that will install python if its not
>> already there and then add your script. There are few cases
>> where you really need an exe file. IMHO.
>> 
>
> Though, yes, you never need to, perhaps you might *want* to, for reasons of 
> "marketability".  For example...if I want to make an application for 
> distribution to others, either for sale or as freeware, and I use the 
> installers option as you mentioned, it is only proper to indicate this to 
> the end user, such as, "In installing this application, the Python 
> programming language and some other libraries will also be installed on your 
> computer."
>   
And what about all the commercial applications that require you to 
install the .NET framework, or Java, to work?
Or games that require DirectX?
People don't have problems with these.
As far as I'm concerned, I'd rather have 45k of source plus the data 
files, than an extra 10mb for Python that I already have installed.
Game downloads don't include DirectX for this reason - it's an extra 100 
megs when most people will have it,
or will have it after they play their first game.  So they put DirectX 
on the CD, and in the game install,
they ask you if you'd like to download and install DirectX if you don't 
have it already.
That's how I think python installs should work.
Just have a little check box that says "Download and install Python if 
you don't have x version or later installed."
That's not any more intrusive than these other applications that force 
you to install stuff.
In fact, it's less intrusive than .NET applications.  It takes forever 
to install the .NET framework,
and I have to navigate through web pages on microsoft.com just to find it!
> But that might trigger a common psychological response from the user, "Oh, 
> no, not a whole complex set of things installed on my computer that I don't 
> understand, have never heard of, and will only need for this one 
> application"
So add it to the 'custom' install path, and on the 'default' install 
path, just scan for Python and install it automatically for them
if they don't already have it.  Applications do this all the time.
>   But downloading a single .exe file and maybe a small folder of 
> images or a few .dll files doesn't conjure that sense.
That's essentially what the Python install is - some exes and some 
folders, that the end user never needs to look inside.
>   If I understand it 
> right, the .exe has Python bundled into it anyway, so such an end user's 
> response isn't strictly rational, but you can see how people might feel this 
> way in an age when there are so many ways one should mistrust software.
>   
Of course you have a valid point - but only because of other people's 
irrationalities.
> Another reason is that, as I understand it, making it an .exe obscures the 
> code (at least enough to make it take a bit more work to reveal the code).  
> For some this might be a benefit?
>   
That's not how py2exe works.  It makes an exe and a library.zip that 
contains all the python code.
so one could simply extract the code from library.zip and use it that way.
And you might say 'well, the code can be byte-compiled to make it more 
obscure.'
Sure, you could do that.  You could also do that without py2exe'ing it.
I believe py2app or pyinstaller or something like that actually includes 
your code in the .exe,
but py2exe doesn't.
> I may be way off base here, just throwing it out as something I've wondered 
> about.
>   
No, everyone thinks about this stuff whenever they consider if they 
should make .exe versions.
Personally, I find in most cases it's just a waste of bandwidth and time 
to make .exe versions.
But then, I haven't sold anything I've written yet, and my target 
audience is usually other programmers.

Honestly, though, Python's easy and quick to install, especially 
compared to Java.
I don't think it should be a big deal.

This sort of thing has to be taken on a case by case basis - determining 
who's the user base,
their level of technical knowledge, their aversion to installers 
including things they've never heard of,
things like this.

HTH,
-Luke
> _
> Get a preview of Live Earth, the hottest event this summer - only on MSN 
> http://liveearth.msn.com?source=msntaglineliveearthhm
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>   


Re: [Tutor] Hi,every one

2007-06-23 Thread Sridhar Ratna
On 6/23/07, Yang Yang <[EMAIL PROTECTED]> wrote:
>
> 1.what is the best book for python study.

Try "Byte of Python"
  http://byteofpython.info/

>
> 2.what's is the better IDE for python
>

Start off with IDLE, which comes with the Python installer. Go through
this IDLE tutorial,
  http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/

(If you're not satisfied, there are numerous Python IDEs available)

-- 
http://srid.nearfar.org/
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] ongoing saga

2007-06-23 Thread Kirk Bailey


Luke Paireepinart wrote:

> I was under the impression that managers e-mailed their workteams if 
> they needed to talk to groups of people.
indivigual messages. many offices have teams working on customer service or
some group task where a leader needs to address the team, NOW, and often in
these environments, will do this by ANNOUNCING messages. This distracts, and
disrupts.
> If the people are on an intranet, there shouldn't be any firewalls 
> blocking their communication.
> The firewall would be between the computers and the internet, correct?
That is the general idea. Some places have several submets and for security
reasons channelize and limit communications between them. This is simple
enoug to install that the group manager's workstation can mount a simple
server for it  to use, avoiding the need to breach the wall. banks come to
mind as a place where there is considerable need for ligh level security
within the firm, devloping something which is classified is another office
environment  where it would be needed.
> 
> The point of a firewall is to block all traffic which may be harmful to 
> computers behind it.
Ah, but the possibility of human trojan agents is why many office use
diskless computers, and internal security. there are situations where one
must guard against iinternal threats.
> If your software listens on port 80, this is an abuse of the firewall 
> spec, IMHO.
Ho so? A web serveris working normally on port 8o. MANY applications are
acccessed through browsers, and through a webserver. So?
> The reason people are willing to open port 80 is because they know the 
> only thing that will be listening
> on the other end is Microsoft IIS or Apache, both applications which 
> have been under constant, stable development for years
> and have good security.  Putting an application you just wrote from 
> scratch with no regard to the security of it provides
> hackers an entrypoint into your network via your application.
But sir,  it IS accessed THROUGH apache, or IIS.
> 
> In addition, I doubt the managers would move to universally supporting 
> your application - many of them would desire to continue to use
> e-mail for communication - and this would result in the workers having 
> just another intrusive application they have to leave open all the time,
> as they're already required to leave an e-mail client active, I would 
> guess.
email sits there waiting for you to look at the email client. this displays
the message  within seconds of sending it- no client must come to the top of
the d esk to be visible, it already is. Please look at the example on the
link I posted to see what I mean.
> 
> Anyway, I'm just a college kid with no experience in this kind of stuff, 
> so if I'm completely wrong then correct me,
> but that's how I'd see it as working.
The dialog is good, and dodging bullets is good mental exercise. raise the
objections, let's see if they draw any blood.
> 
> P.S. my money tree's a little dried up right now but I hope with some 
> water and some love it'll be rejuvenated soon.
> -Luke
The money tree for me is pretty simple; give it away,  let them look at the
example, sell them install and support service. And as it is written in
python, this community of snake charmers are all potential tech support
personell for it. Does that offer any possibility of revenue stream to you?

The example PAGES are on the server now, just look at the source code. Want
to see the script? Let me know.
> 
> 
> 

-- 
Salute!
-Kirk Bailey
   Think
  +-+
  | BOX |
  +-+
   knihT

Fnord.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] pyhook for Linux

2007-06-23 Thread Alan Gauld

"Flaper87" <[EMAIL PROTECTED]> wrote

> Does anyone knows an equivalence of pyhook for linux?

Nope.

> I need to catch the events of the mose (even the simple movement, or 
> when it
> focus an icon on Desktop), and the events of the keyboard.

I think you need to look at the basic X windows event model.
In particular look at how Window Managers like twm/fvwm are
written.

Or the ubiquitous xeyes applet. It tracks the mouse all over
the screen so must catch the mouse events before forwarding
them to the applications.

These are written in C but should give you a clue as to which
events to catch and which windows/event queues to monitor
or API calls to make.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 40, Issue 54

2007-06-23 Thread Alan Gauld

"Che M" <[EMAIL PROTECTED]> wrote in

>>And you can build installers that will install python if its not
>>already there and then add your script. There are few cases
>>where you really need an exe file. IMHO.
>
> Though, yes, you never need to, perhaps you might *want* to, for 
> reasons of
> "marketability".  For example...if I want to make an application for
> distribution to others, either for sale or as freeware, and I use 
> the
> installers option as you mentioned, it is only proper to indicate 
> this to
> the end user, such as, "In installing this application, the Python
> programming language and some other libraries will also be installed 
> on your
> computer."

You could but most Java applications don't warn you that they
are installing the Sun Java JRE onto your system they just do it.
And VB apps don't usually say they are installing VB DLLs on
the system. Of course Python is more than a DLL and you might
like to delete the documentation and sample programs to save
the user space. But a more realistic example is programs which
turn on Active Scripting on a Windows PC. This enables people
to write and run VBScript of JScript programs. Very similar to
Python.

> application"  But downloading a single .exe file and maybe a small 
> folder of
> images or a few .dll files doesn't conjure that sense.  If I 
> understand it
> right, the .exe has Python bundled into it anyway, so such an end 
> user's
> response isn't strictly rational,

So why bother the user, they just get a typical install bundle and
don't need to worry about what run time environment has been
installed?

> Another reason is that, as I understand it, making it an .exe
> obscures the code (at least enough to make it take a bit
> more work to reveal the code).

This is valid but its arguable by how much and whether it would
deter a dishonest pirate much more than a compiled python module.
Or  you might prefer to do a Jython version of your code and
distribute as a Java program instead.

> I may be way off base here, just throwing it out as something
> I've wondered about.

These are valid points but I think they are often grossly over played
and the reality is most folks just think exe because its what they
are used to. IMO Its very much a Windows thing, its very rarely done
in Unix land because there people are accustom,ed to interpreted
applications (in sh, awk, perl, tcl, m4 etc) and their need of an
interpreter. If Unix users can live without it why not Windows users.
Its a matter of changing culture rather than any real technical
advantage. (There may also be a false assumption that an exe
file is somehow inherently faster)

Alan G. 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor