Lenard Lindstrom | 1 Jan 2008 03:03

Re: Passing a Null pointer for numpy array

Perhaps py_object would work provided the function borrows its 
references. The py_object() will create a null object pointer.

nicholas cunliffe wrote:
> If I understand your suggestion it would be to have multiple 
> references to the same DLL function func1, func2 etc each with its own 
> prototype?
>
> The problem in this case is that there are 7 array refs and so the 
> number of prototypes if each of them could be None or array ref and 
> any number could be null or ref then the number of prototypes would be 
> very large indeed.
>
> I think in general the prototype idea is good but for all but simple 
> cases runs into problems. I am having nothing but frustrations and 
> indeed have given up and have turned to void pointers (which check for 
> just about nothing). I have seen the Null or pointer issue come up 
> many times on user boards. Allowing more than 1 definition per 
> argument in the form (long | None) might be an idea. This would allow 
> other practical solutions like the option of using  (ndarray | 
> ctypesarray) for example.
>
> Nicholas
>
>
> On Dec 31, 2007 10:40 PM, Lenard Lindstrom <len-l <at> telus.net 
> <mailto:len-l <at> telus.net>> wrote:
>
>     My  mistake. T_ndDp is not a ctypes type so follows its own rules. If
>     you want to pass NULL to the function then declare the argument as
(Continue reading)

Andrew MacIntyre | 2 Jan 2008 00:17
Picon

Re: ghostscript bindings [SEC=PERSONAL]

I regret I can't give detailed help, but
http://pages.cs.wisc.edu/~ghost/doc/gsapi.htm
contains links to the important info.

The VB stuff is a useful reference IMO as it is a bit easier to digest
and translate to Python than the raw C header.  However, there are ways
to translate the C header to a Python module.

You should be able to use your PDF string and end up with an image in
memory by using the GS API to set stdio callback routines (which ctypes
will allow you to write in Python).

-------------------------> "These thoughts are mine alone!" <---------
Andrew MacIntyre           National Licensing and Allocations Branch
tel:   +61 2 6219 5356     Inputs to Industry Division
fax:   +61 2 6253 3277     Australian Communications & Media Authority
email: andrew.macintyre <at> acma.gov.au 

> -----Original Message-----
> From: ctypes-users-bounces <at> lists.sourceforge.net
> [mailto:ctypes-users-bounces <at> lists.sourceforge.net] On Behalf Of Carl 
> Karsten
> Sent: Thursday, 27 December 2007 6:07 AM
> To: ctypes-users <at> lists.sourceforge.net
> Subject: [ctypes-users] ghostscript bindings
> 
> I am trying to convert pdf to png. (on an over loaded web server, so 
> it needs to
> be done fairly efficiently)   looks like I need to use 
> ghostscript, and there
(Continue reading)

Carl Karsten | 2 Jan 2008 17:04

Re: ghostscript bindings [SEC=PERSONAL]

Thanks.  I'll check it out.

turns out the server admin doesn't care if I create a file, but I still want to 
figure out how to do it 'right'

Carl K

Andrew MacIntyre wrote:
> I regret I can't give detailed help, but
> http://pages.cs.wisc.edu/~ghost/doc/gsapi.htm
> contains links to the important info.
> 
> The VB stuff is a useful reference IMO as it is a bit easier to digest
> and translate to Python than the raw C header.  However, there are ways
> to translate the C header to a Python module.
> 
> You should be able to use your PDF string and end up with an image in
> memory by using the GS API to set stdio callback routines (which ctypes
> will allow you to write in Python).
> 
> -------------------------> "These thoughts are mine alone!" <---------
> Andrew MacIntyre           National Licensing and Allocations Branch
> tel:   +61 2 6219 5356     Inputs to Industry Division
> fax:   +61 2 6253 3277     Australian Communications & Media Authority
> email: andrew.macintyre <at> acma.gov.au 
> 
>> -----Original Message-----
>> From: ctypes-users-bounces <at> lists.sourceforge.net
>> [mailto:ctypes-users-bounces <at> lists.sourceforge.net] On Behalf Of Carl 
>> Karsten
(Continue reading)

Len Remmerswaal | 4 Jan 2008 18:11

Trouble inspecting a SysTreeView32

Hi,

I do not see many questions of this type on this mailing list. Am I off 
topic? Anyway, here goes:

I am having trouble getting the Item information from a "SysTreeView32" 
control in a foreign Windows application.
I can identify the control, I can get the hItem values for all nodes in 
the tree (messages with  TVM_GETNEXTITEM), I can select any item 
(message TVM_SELECTITEM with TVGN_CARET) but I cannot manage to get the 
Item data.

I already tried it using win32gui and win32gui_struct (which seems to be 
alpha code) with no luck and now I am trying it with ctypes, also to get 
to know the package a bit. Some code here is fashioned to the 
win32gui_struct module.

Can anyone indicate what I am doing wrong?

Question on the side: it seems that on instantiating a Structure, the 
object is filled with 0 and None as appropriate for the type.
Is that guaranteed to happen, i.e. can I make EmptyTVITEMEX much smaller?

Here is the code (the relevant parts of it).
As mentioned: methods getTreeRoot and treeSelect work, while 
showTreeItem does not (item is the return value of getTreeRoot):

import ctypes as ct
from ctypes.wintypes import UINT, HANDLE, LPCSTR, LPCWSTR, LPARAM
import commctrl                 # part of PyWin32. Many constants that 
(Continue reading)

Mark McMahon | 4 Jan 2008 18:33
Favicon

Re: Trouble inspecting a SysTreeView32

Hi,

Just a quick message - this is a tricky subject because you have to allocate memory for the structure in the
memory of the foreign application.

You might want to have a look at pywinauto. When I was trying to do the same as you I had to figure it out.

Do a search for common_controls.py (the subversion is on www.openqa.org (I don't have the full address here).

Good luck!
   Mark
--------------------------
Sent using BlackBerry

----- Original Message -----
From: ctypes-users-bounces <at> lists.sourceforge.net <ctypes-users-bounces <at> lists.sourceforge.net>
To: ctypes-users <at> lists.sourceforge.net <ctypes-users <at> lists.sourceforge.net>
Sent: Fri Jan 04 09:11:00 2008
Subject: [ctypes-users] Trouble inspecting a SysTreeView32

Hi,

I do not see many questions of this type on this mailing list. Am I off
topic? Anyway, here goes:

I am having trouble getting the Item information from a "SysTreeView32"
control in a foreign Windows application.
I can identify the control, I can get the hItem values for all nodes in
the tree (messages with  TVM_GETNEXTITEM), I can select any item
(message TVM_SELECTITEM with TVGN_CARET) but I cannot manage to get the
(Continue reading)

Thomas Heller | 4 Jan 2008 18:42

Re: Trouble inspecting a SysTreeView32

Mark McMahon schrieb:
> Hi,
> 
> Just a quick message - this is a tricky subject because you have to
> allocate memory for the structure in the memory of the foreign
> application.
> 
> You might want to have a look at pywinauto. When I was trying to do
> the same as you I had to figure it out.
> 
> Do a search for common_controls.py (the subversion is on
> www.openqa.org (I don't have the full address here).

There is also a code sample (in C) that I found with google, it may give ideas:

http://www.autoitscript.com/forum/lofiversion/index.php?t9988.html

Thomas

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
oyster | 5 Jan 2008 02:27
Picon

Why python says "unexpected parameter 'mini.py'" for my code?

The following is my pure-python wxwidgets test. It runs and gives a
frame, but soon python comes up to say "unexpected parameter
'mini.py'" and I have to close it.
I cannot find the reason. Can somebody give me a hint to let it work
well? Thanks

http://pyguiviactypes.googlepages.com/mini.py

BTW, on my windows 2k, it use the wx-c.dll from
http://wxnet.sourceforge.net/. I think it works on linux too if you
replace wx-c.dll with the proper dynamic library name.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
freelancer | 5 Jan 2008 04:12
Picon

Help with reportman.py

Dear Friends,

I am very keen in mastering the use of python, can someone please tell me
where I can get reportman.py, I need to learn how to create reports from
mysql  and firebird db. thanx a lot for positive help.

have a great day.
Lefu

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Werner F. Bruhin | 5 Jan 2008 14:58
Picon
Favicon

Re: Help with reportman.py

Hi Lefu,

freelancer <at> infinitumphp.co.za wrote:
> Dear Friends,
>
> I am very keen in mastering the use of python, can someone please tell me
> where I can get reportman.py, I need to learn how to create reports from
> mysql  and firebird db. thanx a lot for positive help.
>   
You can find it in the files section of the yahoo list for report manager.
http://tech.groups.yahoo.com/group/reportman/files/

I use it with Firebird SQL and it works very nicely.

See you
Werner
> have a great day.
> Lefu
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> ctypes-users mailing list
> ctypes-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ctypes-users
>
>
>   
(Continue reading)

Matthias Baas | 5 Jan 2008 17:09
Picon

Automatic type conversion for input args to C functions

Hi,

I'm wrapping a couple of C functions from a DLL and I'm using the 
argtypes attribute to declare the types of the input arguments. I can 
call the functions just fine, but I was wondering why I have to provide 
the exact ctypes type as input when using more complex types such as 
arrays or callbacks (whereas Python floats are automatically converted).

Here is an example code snippet (I was using Python 2.5 on WinXP). The 
library ri.dll contains the functions RiColor() which takes an array of 
3 floats as input and a function RiErrorHandler() which takes a pointer 
to a function as input:

   # Create the required types...
   RtColor = 3*c_float
   RtErrorHandler = CFUNCTYPE(None, c_int, c_int, c_char_p)

   # Load the library and declare the input arguments...
   ri = cdll.LoadLibrary("ri.dll")
   ri.RiColor.argtypes = [RtColor]
   ri.RiErrorHandler.argtypes = [RtErrorHandler]

Now I can call the color function like this:

   ri.RiColor(RtColor(1,0,0))

But sometimes it would be more convenient to work with other types like 
tuples, lists or, in this case, a special vector type (that may come 
from another module but that behaves like a list of 3 floats).
But when I try to pass in just a Python tuple or list I get the 
(Continue reading)


Gmane