Re: How do I get curses to work in Python 3.2 on win-64?

2011-10-15 Thread Christoph Gohlke
On Oct 15, 1:13 pm, Jan Sundström  wrote:
> How do I get curses to work in Python 3.2 on win-64?
>
> I'm new to Python and when exploring Python in console I want to use
> some
> simple functions for console programming that don't emulate a
> typewriter
> terminal but rather a text screen terminal. I want to be able to clear
> the screen, position the cursor
> and do unbuffered reading from the keyboard. Also setting different
> colors for the text and background.
>
> That could in Windows be accomplished by the handy WConio (http://
> newcenturycomputers.net/projects/wconio.html)
> which contains just about everything that is needed for a console
> application to become useful.
>
> However I want to accomplish it in Python 3.2 because I lack the
> experience to build it myself. Now an alternative would
> be to use some flavor of curses. Although having a plethora of
> unnecessary functions it has the advantage of
> existing for different platforms.
>
> I'm currently running Python 3.2.2 on win-64
> When Python is installed there is a Python32/Lib/curses library. As I
> understand it this is only a some sort of
> wrapper for a curses module to be downloaded and installed later??
>
> So I downloaded and installed a curses module I that found and which
> seemed appropriate:
>
> curses-2.2.win-amd64-py3.2.exe
>
> from
>
> http://www.lfd.uci.edu/~gohlke/pythonlibs/
>
> It installed some stuff directly in Python32/lib/sitepackages.
>
> Now when I try in a program to do things like:
>
> import curses
> stdscr = curses.initscr
>
> Python complains it can't find curses. However if I do
>
> import _curses
> stdscr = _curses.initscr
>
> etc., everything works fine. I shouldn't have to write the underscores
> though??
> How can I fix that?
> Should I try to find some other version of curses?
>
> It seems I haven't yet grasped how to install a Python module?
>
> /John

`import curses` should work. What exactly is the error message? Does
`import curses` work outside your program/program directory?

The curses package is part of the standard library and usually
installed in Python32\Lib\curses. On Windows the  _curses.pyd files is
missing in the standard distribution. curses-2.2.win-amd64-py3.2.exe
installs the missing _curses.pyd file into Lib/site-packages.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SciPy/NumPy: read, write images using Python3

2011-10-15 Thread Christoph Gohlke
On Oct 9, 8:43 am, thegripper  wrote:
> In SciPy / NumPy, the primary way to read and write images is PIL. But
> PIL does not yet support Python3. Is there some good way to read,
> write, and resize images in a NumPy and Python3 environment?

Try Scikits.image . It uses a plugin system
to read/write images to/from numpy arrays via FreeImage, PyQt, FITS,
GDAL, etc.

Other options:

Unofficial PIL ports, e.g.  or


PythonMagick 

GDAL  for raster geospatial data formats

PyGame 1.9.2pre , uses SDL_image

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


Re: Win7. Why Don't Matplotlib, ... Show up in Control Panel Add-Remove?

2010-08-08 Thread Christoph Gohlke
On Aug 8, 9:54 pm, "W. eWatson"  wrote:
> On 8/8/2010 5:51 PM, Steven D'Aprano wrote:
>
> > On Sun, 08 Aug 2010 16:15:45 -0700, W. eWatson wrote:
>
> >> To suggest Google as above, makes no sense to me. This is the place to
> >> ask, as another poster stated.
>
> > He may have stated it, but the evidence suggests he's wrong. You're
> > asking a question about the details of the installers used specifically
> > by scipy andmatplotlib. Most people here have no idea about that, hence
> > the lack of useful answers. The best likelihood of finding a solution is
> > to go to a specialist forum, not a generic one.
>
> > In any case, suggesting Google is *always* relevant. You gave us no
> > reason at all to think that you had made any effort to solve the problem
> > yourself before asking for us to volunteer our time. That's rude. Did you
> > google for "uninstall scipy" before asking for help? Did you make any
> > effort to read the Scipy manual first? Did you make any effort *at all*?
> > If you had -- and for all we know, you might have spent days trying to
> > solve this, or 3 seconds, or anything in between -- you didn't say so.
>
> > Suggesting that you do some googling is absolutely relevant.
>
> > Perhaps it's about time that we point you at this:
>
> >http://catb.org/esr/faqs/smart-questions.html
>
> > Idon'tagree with everything the author says, but the basic position is
> > about right.
>
> For the last few hours, I've been on the scipy and numpy mail list, per
> a suggestion. No one seems to really understand uninstall there.

Well. Your question has been answered on Numpy-discussion in February
and again today on SciPy-users.

> I think
> Ben Caplan may have it right. You and I need go no further with this. We
> disagree--again.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python use with Mightex Buffer USB camera

2010-10-27 Thread Christoph Gohlke
On Oct 27, 7:16 am, Greg Miller  wrote:
> Does anyone have any experience using Python and ctypes to interface
> with one of the Mightex USB cameras?  I am following the CPP code
> example and so far I think I've done pretty well talking to the dll.
> I am able to get serial number information back from the camera,
> however I am not sure if I'm using the ctypes pointer( ) correctly to
> send the pointer to the data structure that the camera is supposed to
> fill in when I make a call to grab a current frame.  Mightex tech
> staff has been VERY helpful, but they don't know Python.

I'm not familiar with the Mightex API, but assuming a C function
'getframe' in the mightex.dll takes a camera handle (typically a C
int) and a pointer to a C unsigned short (16 bit) image buffer, you
could allocate the image using numpy and pass a pointer to the image
data to mightex.getframe as follows (code not tested):

mightex = ctypes.windll.LoadLibrary('mightex.dll')
# omitted code to open camera, get camerahandle, frame width and
height
PUSHORT = ctypes.POINTER(ctypes.c_uint16)
mightex.getframe.argtypes = (ctypes.c_int, PUSHORT)
image = numpy.empty((width, height), 'uint16')
mightex.getframe(camerahandle, image.ctypes.data_as(PUSHORT))

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