Getting an image from a file on windows

2015-05-28 Thread IronManMark20
Hello,

I have been working on a function that gets a bitmap of the thumbnail for a 
file. I have had problems getting a large image (256x256) and I was wondering 
if someone could help me on one object initialization that is driving me nuts.

I have code here: https://gist.github.com/IronManMark20/a83fe7ff7ea9b40c09af

I need to initialize a *void pointer for the third argument for SHGetImageList 
(ref https://msdn.microsoft.com/en-us/library/bb762185). 

What should the initialization look like (please give me example code, not just 
Oh it should be a ctypes.c_void_p).

Thanks!!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Getting an image from a file on windows

2015-05-28 Thread IronManMark20
On Thursday, May 28, 2015 at 5:37:07 PM UTC-7, MRAB wrote:
 On 2015-05-29 01:03, IronManMark20 wrote:
  Hello,
 
  I have been working on a function that gets a bitmap of the thumbnail
  for a file. I have had problems getting a large image (256x256) and I
  was wondering if someone could help me on one object initialization
  that is driving me nuts.
 
  I have code here:
  https://gist.github.com/IronManMark20/a83fe7ff7ea9b40c09af
 
  I need to initialize a *void pointer for the third argument for
  SHGetImageList (ref
  https://msdn.microsoft.com/en-us/library/bb762185).
 
  What should the initialization look like (please give me example
  code, not just Oh it should be a ctypes.c_void_p).
 
  Thanks!!!
 
 Have you tried byref(hico)?

Thanks so much! That seems to have done it. Now I get to figure out how to get 
the image. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Getting an image from a file on windows

2015-05-28 Thread IronManMark20
On Thursday, May 28, 2015 at 5:37:07 PM UTC-7, MRAB wrote:
 On 2015-05-29 01:03, IronManMark20 wrote:
  Hello,
 
  I have been working on a function that gets a bitmap of the thumbnail
  for a file. I have had problems getting a large image (256x256) and I
  was wondering if someone could help me on one object initialization
  that is driving me nuts.
 
  I have code here:
  https://gist.github.com/IronManMark20/a83fe7ff7ea9b40c09af
 
  I need to initialize a *void pointer for the third argument for
  SHGetImageList (ref
  https://msdn.microsoft.com/en-us/library/bb762185).
 
  What should the initialization look like (please give me example
  code, not just Oh it should be a ctypes.c_void_p).
 
  Thanks!!!
 
 Have you tried byref(hico)?

Could you suggest how I could get an hIcon from the newly drawn image? I have 
been trying, but I haven't found anything.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: OpenCV with Python (cv or cv2)

2015-05-26 Thread IronManMark20
On Tuesday, May 26, 2015 at 6:52:00 AM UTC-7, Markos wrote:
 Hi,
 
 I want to use OpenCV with Python.
 
 I installed version 2.4.9 
 (http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip/)
  
 in debian Squeeze running Python 2.6.6. Using the tutorial: 
 http://indranilsinharoy.com/2012/11/01/installing-opencv-on-linux/
 
 (I tried to install versions 2.4.11 and 2.4.10 (in Squeeze with python 
 2.2.6) but I couldn't.)
 
 I lost some time trying to load the module cv2:
 
   Import cv2.cv the cv
 Traceback (most recent call last):
 File stdin, line 1, in module 
 ImportError: No module named cv2.cv
 
 After a while I realized I could use the cv module. (import cv)
 
 But still I do not understand the differences between the modules cv and 
 cv2.
 
 Do you suggest any good tutorial about the differences between cv and cv2?
 
 I will have to make many changes in python programs using cv to reuse 
 the code later with cv2?
 
 Thanks,
 Markos

To actually answer your questions, cv2 is the newest and best opencv binding. 
It uses numpy arrays, instead of what cv uses. This means it is much easier to 
deal with. I will also point you to 
https://stackoverflow.com/questions/10417108/what-is-different-between-all-these-opencv-python-interfaces
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best GUI for Python

2015-04-26 Thread IronManMark20

 
 But just curious: what is the reason you use five different kinds of
 GUI? It seems like it makes think difficult for you. I mean the
 question as enlightenment for myself.

A good question :). Most of this comes from the openness to create binding for 
many projects. Tkinter is a binding of Tk. pyGTK is a binding of GTK, which is 
written in c++, the same is true of PyQt/PySide, which binds Qt. wxPython binds 
wxWidgets. 

I find the variation good, because it means there are more choices. I use PyQt, 
because I wanted very cross platform code, other choose pyGTK because they want 
to closely integrate with the GTK environment. 

Your choice of GUI library depends on what you are targeting.
-- 
https://mail.python.org/mailman/listinfo/python-list


Hooked, a pure Python Windows Hotkey module

2015-04-20 Thread IronManMark20
Announcing Hooked

Hooked is a pure python hotkey module. There are some great options such as 
pyHook, and pyhk,  but I wanted a pure Python version so all Python 
implementations could use hotkeys.


Now, an example!
def foo():
print I was triggered by Ctrl+B!
from hooked import hook 
hk=hook() #make an instance of hooked
hk.Hotkey([LCtrl,B],foo) #the left ctrl+b causes foo to trigger
hk.listen() #start listening for the hotkey

I just made this yesterday, so more updates over the next few days.
Features:
* It should support all keyboard keys
* It should allow for an unlimited number of hotkeys to be registered.
* It is pure Python, which means you can go and edit things easily.
* It supports all versions of Windows since 2000.
* It _only_ uses the standard library. No need for pywin32.

Hooked is licensed under the GPL v2. 

The source is here:https://github.com/IronManMark20/hooked

Thoughts? Suggestions? Requests? etc?
-- 
https://mail.python.org/mailman/listinfo/python-list


ctypes: using .value or .value() doesn't work for c_long

2015-04-15 Thread IronManMark20
I am using ctypes to call a few windll funcions. One of them returns a c_long 
object. I want to know what number the function returns. 

Problem is, when I try foo.value , it gives me this:

AttributeError: LP_c_long object has no attribute value.

Any idea of what could cause this?
-- 
https://mail.python.org/mailman/listinfo/python-list