Re: [python-win32] optimizing code to read serial port

2014-02-16 Thread RayS

At 08:14 AM 2/15/2014, you wrote:

Vernon

Your suggestion is interesting but not practical for our needs.


Have you profiled pySerial? http://pyserial.sourceforge.net/examples.html
I use it in my LX200 serial telescope package
http://rjs.org/Python/LX200/LXSerial.py/LXSerial.html
http://rjs.org/Python/LX200.zip

- Ray

___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Win32 GUI for beginners.

2014-01-18 Thread RayS

At 10:10 AM 1/18/2014, Christophe Dezé wrote:

You can try boa constructor.
It's simple.I've begun with it.

PS it's a bit obsolete,but i works as well


The one thing Boa hasn't been updated for is the 
AGI widgets, which would be nice.



___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Win32 GUI for beginners.

2013-12-31 Thread RayS
I was in a similar place about 12 years ago, and settled on wx 
http://wiki.wxpython.org/How%20to%20Learn%20wxPython and 
BoaConstructor http://sourceforge.net/projects/boa-constructor/, 
which has served well since.
A good book I'd bought is now online 
http://eduunix.ccut.edu.cn/index2/pdf/Manning.Publications.wxPython.in.Action.Mar.2006.pdf


Qt also has a nice widget set and examples etc, but is not LGPL - a 
factor for me.


- Ray



On Dec 31, 2013 3:11 AM, Sean Murphy 
mailto:mhysnq1...@icloud.commhysnq1...@icloud.com wrote:

Hi all.

I am very very new to Python. I have read the book on programming 
for Windows with Python that was released in 2000. The book is very 
good but doesn't give me the basic information I am seeking. Since I 
am a beginner programmer.


I want to create a GUI windows app with Python. The program has to 
use default Windows 32 or 64 bit objects. I wish to get the 
following components:


Menu bar
Listview
Treeview
Richedit or a multiline edit field
A couple of buttons.
All objects must be able to be access by the keyboard. either via 
tab stops (using the tab or shift tab key) and short cut keys.



I have a 70 mb text file that is marked up using YML. I wish to show 
each section in the edit field. The list view shows the name of each 
item. The tree view will contain categories.


I have seen PYGUI which I am not sure if it is easier then using the 
MSF approach which the book above mentions.


So I really need assistance to progress this home bobbie project to 
expand my programming skills. Any wikis, documentations, good code 
examples with explanations, etc I would love to get my hands on.


I am reading about 3 or 4 books on Python to get up to speed. But 
only found one book on Win32 programming. I do not want to have to 
turn around and learn win32 or MFC. If I have to then please point 
me towards a good book or resource.



Regards
Sean




___
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Recurring DLL error with py2exe

2011-08-26 Thread RayS

At 06:02 AM 8/25/2011, Jacob Kruger wrote:


The last 2 lines rendered in that window are then the following:
*** finding dlls needed ***
error: MSVCP90.dll: No such file or directory

That specific DLL gets copied quite easily into the relevant 
subfolder of the dist folder when I run a similar command for my 
much larger, but, I suppose, simpler, mapData app, since that one 
doesn't try to import libraries/modules like piaudiere or wxPython as such.


Any thoughts on what could really be happening here, or should I try 
sort out reinstalling windows7 or something...?


I always explicitly bundle the *90 dlls with the exe using includes 
[], or the user needs the redistributable. Even if Win7 ships with 
*90 dlls you might still need explicit copies.
Re-view the tutorial for more setup hints 
http://www.py2exe.org/index.cgi/Tutorial#Step52httphttp://www.py2exe.org/index.cgi/Tutorial#Step52://www.py2exe.org/index.cgi/Tutorial#Step52 


I'm still wrangling with dynamic import errors...
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] py2.7 and multiple DDE servers on Win32, possible?

2011-06-14 Thread RayS

Ahh, this
http://www.codeproject.com/KB/MFC/MFCinVisualStudioExpress.aspx
might help.
I'll work through it later...
I do have VS6, but I'm assuming that I really need 2008 (?).

Thanks,
Ray

At 10:13 PM 6/13/2011, Roger Upole wrote:

Compiling with VC 2008 Express is going to be a problem.  The free
compiler doesn't seem to support using the atl/mfc headers and libraries.

 Roger
___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] py2.7 and multiple DDE servers on Win32, possible?

2011-06-11 Thread RayS

Nice, I'll give it a shot, providing they compile with free VS2008 Express (?)
The old page is a tad out of date 
http://starship.python.net/crew/mhammond/win32/BuildingExtensions.html

but it seems this might help
http://mattptr.net/2010/07/28/building-python-extensions-in-a-modern-windows-environment/
I'll also check with Enthought (I have their full MKL edition).

Ray

At 03:47 AM 6/11/2011, Roger Upole wrote:

If you can build the dde module yourself, reenabling multiple servers
for 32-bit is just a matter of uncommenting

// #define _CALLHACK_

in stddde.cpp.

 Roger



___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] py2.7 and multiple DDE servers on Win32, possible?

2011-06-10 Thread RayS

Hello

I know that the default behavior since 2.? has been only one DDE 
server allowed.

Is it possible to back-hack this restriction?

I asked similarly a while back
http://mail.python.org/pipermail/python-win32/2010-October/010774.html
and Roger replied:
It was done through some low-level hacks to create new C functions 
on the fly, which set off DEP and crashed in a 64-bit build. 


http://python.net/crew/pirx/win32/dde.zip 
(http://www.koders.com/cpp/fid7F744C525820DA799D8AB0484F2F97152DF30852.aspx?s=setwindowshookex) 
is apparently an older implementation and attempting to import the 
included dde.pyd fails with type 'exceptions.ImportError' : DLL 
load failed: The specified module could not be found.

whether placed in Python27\DLLs or Python27\Lib\site-packages\pythonwin.
I assume that it would need to be compiled with MVC2008/Py2.7 to hope 
to work...


I have a legacy 6 year old DDE client app that I would really like to 
support with a new data server...


Ray

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] Convert RGBA to BGRA using standard library?

2011-05-31 Thread RayS


Something like?
 a=numpy.array([1,2,3,4,5,6,7,8])
 b=a.reshape(2,4).copy()
 b
array([[1, 2, 3, 4],
 [5, 6, 7, 8]])
 b[:,0]=a.reshape(2,4)[:,2].copy()
 b[:,2]=a.reshape(2,4)[:,0].copy()
 b
array([[3, 2, 1, 4],
 [7, 6, 5, 8]])
See also

http://www.mail-archive.com/numpy-discussion@scipy.org/msg18651.html
Ray
At 11:53 AM 5/31/2011, Tim Roberts wrote:
Greg Ewing wrote:
 Can anyone think of an efficient way to convert a string
 full of RGBA image data to BGRA, using only what's available
 in the standard library?

 I'm trying to add a function to PyGUI for creating an Image
 object from arbitrary data. The problem I'm having is that
 GDI+ on Windows expects BGRA, whereas most other platforms
 deal with RGBA. I don't want to require the user to supply
 the data in different formats on different platforms, so
 PyGUI needs to be able to convert where necessary.

 I know the conversion can be done easily using something
 like PIL or numpy, but I'm after a solution that doesn't
 depend on any third-party libraries.
Nothing other than brute force.
 bout = []
 for i in range(0,len(bin),4):
 bout.extend( [bin[i+2], bin[i+1], bin[i], bin[i+3])
)
It ain't gonna be quick. If it were me, I'd rather ship
PIL.
-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.
___
python-win32 mailing list
python-win32@python.org

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



___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] First post to list, etc.

2011-05-17 Thread RayS


At 06:16 AM 5/17/2011, Jacob Kruger wrote:

I’m now (finally) starting to
actually try get started with python, etc., and aside from being partly
interested in the symbian/phone implementation thereof, I am initially
just starting off looking into python apps running on windows systems,
but aside from an actually installed interpreter, etc., am also just
wondering about things like the sort of wrapper possibilities, where you
can include some sort of compiled python code in an .exe file
etc.

http://www.py2exe.org/index.cgi/Tutorial
Almost all my code gets compiled
you can also include C in your code, or Win32 library calls via
ctypes

That should then be able to
(hopefully) run on most windows machines as a sort of standalone app, but
if I’m totally confused about possibilities, then would also like to know
for sure, and also wondering if this might be related to being limited to
only certain versions of python, etc.?
there is not a py2exe for Python3 yet, but you can still
freeze apps and distribute only compiled libraries

http://cx-freeze.sourceforge.net/

Currently have both 2.6 and
3.2 installed on this machine – windows7 32 bit, but also on my other
primary machine – windows7 64 bit, but I do also have another windows XP
machine that might also want to test/try these things out
on.
I stick with 2.6/2.7 for now, as many of the nicest libraries are not
ported to 3 yet


Alternatively, where’s the best place to start looking for things like
this?

http://pypi.python.org/pypi
http://wxpython.org/




___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] access violation debugging advice?

2010-11-06 Thread RayS
I'm accessing a 3rd party ctypes cDLL function and getting 
WindowsError access violation at 0x at seemingly random time 
intervals; what tips does the group have for debugging? The DLL 
author is an MS C++ guy and not Python literate. The DLL appears to 
run without error with his MSVC apps. It almost seems CPU-load 
dependent, but I could be imagining that...
It is for data acquisition, and I seem to be forced to restart my app 
to get around the trapped error and restart (although I haven't tried 
un-setting the ctypes objects).


- Ray

___
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] How to take a snapshot of a specific control?

2006-12-07 Thread RayS


Check this post:

http://mail.python.org/pipermail/python-win32/2003-June/001129.html

win32gui.EnumWindows(_MyCallback, windows)
for i in windows:
if
win32gui.IsWindowVisible(i): 

if
win32gui.IsWindowVisible:



windowsText.append(i)



winDict[numWindows] = i


numWindows +=1
is what you want.
I'm trying to do a fast desktop capture myself, and having DC/pyDC
confusion.
Ray

At 08:15 AM 12/5/2006, Michiel Vleugel wrote:
Hello list,
I'm trying to come up with a script that will take a screenshot of 
internet exploder, (for IE automated unittest script for web 
development) but having trouble drilling fown to the dc of the
control.
It looks like I the control that is needed is called Internet 
Explorer_Server inside the IE application. How can I get the dc of
this 
control?
I tried getting it by using GetDC() on the control, but it doesnt seem

to work (cause that only works on windows, not on controls).
Any help is greatly appreciated!
Michael Vleugel
___
Python-win32 mailing list
Python-win32@python.org

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



___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] screen capture and win32gui.GetDesktopWindow()

2006-12-06 Thread RayS
At 05:02 PM 12/6/2006, Tim Roberts wrote:
Ray Schumacher wrote:
  I've been mulling screen capture code. I tried PIL's
  ImageGrab().grab() (with pymedia) but find PIL's method to be pretty
  slow, ~4grabs per second max with no other processes.
  pymedia is pretty quick once I hand it the data.

How large is your screen?  A 1600x1200 true-color desktop is 8 megabytes
worth of pixels, and it can take tens of milliseconds just to copy it
over the PCI bus to main memory.

1024x768, and I want to immediately resize to 640x480 (or smaller) 
before handing off to pymedia for MPEG input.
I have a PIL version that does ~3.2fps, and, the PIL method does not 
capture the mouse...
Gabriel's suggestion of watching events for copying sub-areas is good...
I can track the mouse using pyHook, I think.

  I putsed around with win32gui
  desktop = win32gui.GetDesktopWindow()
  dt_l, dt_t, dt_r, dt_b = win32gui.GetWindowRect(desktop)
  but couldn't see how to get at the data via the handle.
 

You can use BitBlt to copy it to a DIB, but it's not going to be very
convenient to work with.

I'll try it; all I want to do is downsample and send it off to 
pymedia as a string:
vcodec.VFrame( PIX_FMT_RGB24, (640, 480), (s, None, None))

I had made a version of
http://pymedia.org/tut/src/make_video.py.html
with PIL ImageGrab().grab() as the string source, profiled, and saw 
that it was the PIL method as 80+% of the time.

Thanks all,
Ray

___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] sleep() for less than .001s?

2006-08-04 Thread RayS
At 02:59 AM 8/4/2006, Gabriel Genellina wrote:
I'm not sure if this really works, but you could try:
- Raise your thread/process's priority using SetPriorityClass or 
SetThreadPriority. This is to minimize the (unpredictable) delay of sleep()

I do launch the module with CreateProcess with RealTimePriority - it 
does stabilize things a bit

- Keep your qPC loop, but insert a sleep(0) call, this would free the CPU.

Does 0 have a special meaning vs. .001 for example? I'll give it a try.
The desired total delay is about .0056s, so I'd like to sleep() for 
~.004 and then wake up and catch the exact tick. For some reason, 
sleep(.001) actually adds up to a good bit more, like .004, and 
sleep(.0001) collapses to ~statement execution time, like 10us! 
That's why if I use .0001 the CPU is still 100% loaded; with .001 it 
drops to near zero, but, the timing is way off.
I'l do an example code to demonstrate, and see if others get the same 
responses.

I'm wondering if sleep() uses the 8254 or RTC timers instead of the 
TSC counter or APIC timer(?)

I did see an interesting point about RTAI as well  Also, one should 
note that nanosleep() is a busy wait in the kernel when the request 
to sleep is for an amount of two milliseconds or less. Therefore, a 
busy wait would not simulate interrupt response time as well as a 
true sleep. , so LINUX does not have a true short sleep() either...

http://www.rtems.com/ml/rtems-users/2004/march/msg00067.html
has a good discussion as well that I need to look into.

Thanks,
Ray 

___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


[python-win32] pyHook on Win98; no events

2006-02-15 Thread RayS

To debug pyKeyLogger, I wrote this with pyHook (and compiled with 
py2exe on Win2K), which prints the ascii codes as expected on Win2K:

import pyHook
import time
import pythoncom
def OnKeyboardEvent(event):
   print event.Ascii
def main():
   hm = pyHook.HookManager()
   hm.KeyDown = OnKeyboardEvent
   hm.HookKeyboard()
   while True:
 pythoncom.PumpMessages()
if __name__ == '__main__':
main()

It silently does nothing on Win98...
What is needed? py2exe on 98? I did test it on a fresh install of 98...
I also just thought about trying loading ANSI.SYS at boot, but I 
can't test until tomorrow.

Thanks,
Ray 

___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] closing processes

2005-09-10 Thread RayS
I use pv command line version on 9x ME Windows, and call it with os.system etc.
http://www.pcworld.com/downloads/file_description/0,fid,6102,00.asp
also
http://www.beyondlogic.org/solutions/processutil/processutil.htm

For newer OSs, use WMI, as in
http://mail.python.org/pipermail/python-win32/2003-October/001329.html

Ray Schumacher


At 08:37 AM 8/12/2005, Jim Vickroy wrote:
ryan pinto wrote:

hi - need some help,

Looking for some way to close processes which are
open. Is there any way that a process can be detected
if its running and then closed.

Ryan

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32
  

Have you looked at section 6.1.5 Process Management in the Python 
Library Reference or, alternately, the win32process module?

HTH -- jv
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32


Re: [python-win32] list/kill processes on Win9x and NT+...

2005-07-12 Thread RayS
Ah, now I just found after searching for CreateToolhelp32Snapshot
http://sourceforge.net/mailarchive/message.php?msg_id=8291643

Thanks Gabriel,
Ray

At 07:46 PM 7/12/2005, Gabriel Genellina wrote:
At Tuesday 12/7/2005 14:04, Ray Schumacher wrote:

I had looked over the methods to list/kill processes on Win32, and could not 
(yet) find a pure Python way to do it that works on 9x, since I could not 
get win32pdhutil to work on 98.
So, I combined subprocess.py and pv.exe from
http://www.xmlsp.com/pview/PrcView.zip
and wrote a quick app to kill unauthorized process and compiled with py2exe.

Does anyone have a way to list/kill without the external process that works 
in all 9x and XP?

PDH will work for NT, 2000 and up. For Win95/98 you can enumerate processes 
using ToolHelp32: http://support.microsoft.com/kb/q175030/


Gabriel Genellina
Softlab SRL 

___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32