how to implement propertyPage using wxPyhton?

2005-09-26 Thread James Hu








Hi, gurus,

 

I would like to implement something like propertyPage (VC++ term)

Ie. There are a few tabs in the  top, clicking any tab will display
a different panel.

I searched on the Internet, couldn’t get any clue.

 

Thanks in advance.

 

James






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

use staticBitmap to show image with raw data?

2005-09-28 Thread James Hu








Hi,

 

We have a HAMAMATSU
camera, and we want to display the real-time image (captured every 0.2s+) on
the screen. The captured image from camera is raw data, If saved to PNG file
via Image (PIL), and open with wx.Image(“*.png”), the image can be
shown on the wx.staticBitmap area.

However, the problem is the speed, the capturing takes some
time(nothing we can do),  the saving takes more time, the total speed is
not acceptable completely.

 

There must be a way to show the raw image on screen directly
without saving to file, any idea would be appreciated!

 

I tried:

 

using raw data from Image (Image.fromstring('I', datasize,
newbuftemp, 'raw', 'I;16')), then convert it to wx.Image by using PILToWX,
which downloaded from internet, all pixels are 255!

 

Regards,

 

James

 

 






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

python's performance

2005-09-29 Thread James Hu
Hi,

I used python and PIL to capture image from a digital camera,
It seems like it took more than 1 second to capture a 1280x1024 image,
however, the demo capturing application from the company (coded by VB)
took only .2s or less for one image with the same size.
Don't know why python and PIL is so slow, any idea to improve the
performance? Thanks a lot!

James

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


return struct in ctypes

2005-10-05 Thread James Hu
hi,
 
I need to use ctypes to call the API function 
like
 
fun1(&list, 
listLen)  //here 
 list is struct { long id; long type; long 
isOpen;}  ListItem;
 
so I define
class LIST_ITEM(Structure):    _fields_ 
= [("Id", 
c_ulong),    
("Type",c_ulong ),   
    
("isOpen", 
c_ulong),   
    
]
 
list=LIST_ITEM()
listLen=c_ulong(1)
thedriver.fun1(byref(list),listLen)
doesn't work, here the list is input param, not 
return info.
 
if use 
list=c_char_p()
thedriver.fun1(byref(list),listLen)
 
how can I convert the list to LIST_ITEM?
 
another Q is :
how to use ctypes to implement this:
 
  struct1 
mySettings;  
// here struct1 {long size; 
long params[32];}   mySettings.size = 
sizeof(mySettings); 
 
Where can get ctypes good samples? the samples with the 
package seems very simple. and the ctypes tutorial doesn't handle 
these cases either.
 
Thanks in advance
 
James
 
 
 
 
 -- 
http://mail.python.org/mailman/listinfo/python-list

ctypes questions

2005-10-06 Thread James Hu

Convert 

unsigned long imageSize;
Frame.pBuffer=new unsigned char[ imageSize ]

To 

buffer = (c_ubyte * imageSize)()# create array
Frame.pBuffer = addressof(buffer)

Frame.pBuffer =  (c_ubyte * imageSize)()
TypeError: can't multiply sequence by non-int

Please help me out, thanks in advance

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


PIL Image can't open png file with "I"?

2005-10-07 Thread James Hu
Hi,

I have png file with mode "I", 16 bit,
And I tried to open it with im=Image.open("output.png"), im.show()
I got all white image.
Don't why?
Can Image only support 'RGB' or 'RGBA' png files?

Thanks 

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


create user message for wxPython

2005-10-20 Thread James Hu
Hi,

There are 2 wxPython application, A and B and need to exchange msg.
Sending WM_CLOSE, wxEVT_MOUSEWHEEL to B is OK, and sending user message
like 1225 from A to B is also OK. 

But B didn't catch this message, note, B is running before A sends msg
and can receive "WM_CLOSE". 

Do I have to make my own msg loop by using win32api, win32gui? I used
win32gui to post Message to other windows.

Using wx.Frame:

wx.EVT_START_MSG= 1225
EVT_START_MSG_EVENT= wx.PyEventBinder(wx.EVT_START_MSG, 0)


EVT_START_MSG_EVENT(self, self.OnStart)
Or 
Self.Bind(EVT_START_MSG_EVENT,self.OnStart)

def OnStart(self, event):
  print 'got start message'

Thanks a lot in advance!

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


findwindow by its class name

2005-10-21 Thread James Hu
Hi,

For the simple code:

from wxPython.wx import *
 
class MyApp(wxApp):
def OnInit(self):
frame = wxFrame(NULL, -1, "Hello App")
frame.Show(true)
self.SetTopWindow(frame)
return true
 
app = MyApp(0)
app.MainLoop()

Is there any way to know this windows' class name? I need to find it by
win32gui.FindWindow(classname,None) and send msg from another
application, but not using its title "Hello App".
MyApp is not the classname, for it couldn't be found by
FindWindow("MyApp",None).

Thanks a lot in advance!

James

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


RE: [python-win32] findwindow by its class name

2005-10-21 Thread James Hu
Thanks a lot! Yes, GetHandle() can return 'wxWindowClassNR', which is
nice,
but all wxPython apps return wxWindowClassNR as well, so when I Post
Message, it goes to itself. 

James

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Paul Moore
Sent: Friday, October 21, 2005 2:28 PM
To: Steve Holden
Cc: python-list@python.org; python-win32@python.org
Subject: Re: [python-win32] findwindow by its class name

On 10/21/05, Steve Holden <[EMAIL PROTECTED]> wrote:
> > Is there any way to know this windows' class name? I need to find it
by
[...]
> I'm not saying it can'ty be done (which is a pity for you, because
> that's usually a cue for someone to contradict me) but it's expecting
> quite a lot of win32gui. A wxPython application is not a windows
handle,
> and I suspect you will find that the classname you seek isn't visible
> from inside (wx)Python.

You had to make me do it, didn't you? :-)

wxPython windows expose their HWND via the GetHandle() method. So you
can get the frame's class name as

win32gui.GetClassName(frame.GetHandle())

FWIW, I get a constant value of "wxWindowClassNR".

Hope this helps,
Paul.
___
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32
-- 
http://mail.python.org/mailman/listinfo/python-list


simulate DoEvents by python/wxpython

2005-10-26 Thread James Hu










Hi, all gurus,

 

I  need to simulate DoEvents in VB by
python/wxPython, 

My application needs to capture live image
in a loop until one specific button pressed

Multi-thread is also not very good
solution, for there are big number of data to exchange between the two threads.

 

Win32gui doesn’t have PeekMessage.

 

Or translate the folllowinf codes to
python?

 

DoEvents()

{

  MSG msg;


while ( ::PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )

   
{

   
if ( !PumpMessage( ) )

   
{

   
::PostQuitMessage( 1 );

   
return FALSE;

   
}

   
}

   
// let MFC do its idle processing

   
LONG lIdle = 0;

   
while ( OnIdle(lIdle++ ) )

   
;

   
return TRUE;

   
}

}

 

 

Thanks in advance,

James








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

RE: [python-win32] simulate DoEvents by python/wxpython

2005-10-27 Thread James Hu
Thanks a lot!

-Original Message-
From: Mark Hammond [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 26, 2005 7:16 PM
To: James Hu; Python-win32@python.org; python-list@python.org
Subject: RE: [python-win32] simulate DoEvents by python/wxpython

Build 205 of win32gui does have PeekMessage etc so you can now write the
message loop in Python should the need arise - however, the various
"PumpMessages" and "PumpWaitingMessages" functions do the same thing,
but
are implemented in C.  There are versions of these functions in win32gui
and
win32ui.  win32ui is the MFC wrapper, and its version does do it the
"MFC
way", as opposed to the vanilla Windows way that win32gui exposes.  Your
code below looks like it is MFC based, so the win32ui versions may work
better for you (eg, work correctly with the MFC idle processing).  If
you do
truly only need VB DoEvents style processing (which is not MFC aware),
win32gui.Pump(Waiting)Messages should be fine though.

Mark
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of James Hu
Sent: Thursday, 27 October 2005 4:10 AM
To: Python-win32@python.org; python-list@python.org
Subject: [python-win32] simulate DoEvents by python/wxpython


Hi, all gurus,

I  need to simulate DoEvents in VB by python/wxPython,
My application needs to capture live image in a loop until one specific
button pressed
Multi-thread is also not very good solution, for there are big number of
data to exchange between the two threads.

Win32gui doesn't have PeekMessage.

Or translate the folllowinf codes to python?

DoEvents()
{
  MSG msg;
 while ( ::PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
{
if ( !PumpMessage( ) )
{
::PostQuitMessage( 1 );
return FALSE;
}
}
// let MFC do its idle processing
LONG lIdle = 0;
while ( OnIdle(lIdle++ ) )
;
return TRUE;
}
}


Thanks in advance,
James

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


drag/move image from staticBitmap control?

2005-10-28 Thread James Hu








Hi, all gurus,

 

I have an application to show bitmap image
on one wx.staticBitmap control area, I can display part of the image, or the
whole image(detail is unclear),

But I would like to use mouse to drag/move
the image inside thewx.staticBitmap control when only part image on the screen,
just like maps.google does, 

is it possible to do that?

Any sample code or any idea or suggestion
are appreciated!

Have a nice weekend!

 

James






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

callback for ctypes

2005-11-01 Thread James Hu
Hi, gurus,

I would like to use ctypes to implement callback function for QImage
Camera to capture image asynchronously, and I have the c++ code of
callback, but I am totally in the dark, the ctypes tutorial is not good
enough for me to do that, does someone know where to dig more info for
ctypes callback implementation?

Thanks,

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


tiff tags

2005-11-10 Thread James Hu








 Hi,

 

Is any way to write more tags to tiff file
when saved from:

 

im= Image.fromstring("I",
datasize, newbuftemp, 'raw', 'I;16')

im.save(“myfile.tif”)

 

the tag are: 

256=(640,)

257=(512,)

258=(16,)

259=(1,)

262=(1,)

273=(110,)

278=(512,)

279=(4, '\x00\x00\n\x00')

 

But there are more: how can I write the
following tags?

 

296=(1,)

266=(1,)

339=(1,)

282=((1073741824, 1073741824),)

283=((1073741824, 1073741824),)

284=(1,)

305=(2, ...)

269=(2, …)

274=(3, '\x01\x00')

277=(3, '\x01\x00')

 

Thanks a lot!

 

James






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

RE: IE Temporary Internet Files & Python

2005-11-10 Thread James Hu
Maybe the reason is ..\Content.IE5\index.dat can't be deleted! 


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
rtilley
Sent: Thursday, November 10, 2005 11:03 AM
To: python-list@python.org
Subject: Re: IE Temporary Internet Files & Python

Laszlo Zsolt Nagy wrote:
> 
>> The script does not seem to work when used on Temporary Internet
Files.  
>>
> Doesn't work well? What does it mean? Is there an exception raised?
> 
>  Les
> 

No exception. The files are not deleted.
-- 
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


911, need drvmcdb.sys desperately

2005-11-12 Thread James Hu
Hi, 
 

Sorry to post this message, but I need emergency help, please help me
out! 

I couldn't get drvmcdb.sys from internet, which I accidentally deleted
last night, my laptop (XP) couldn't reboot anymore, but I need to keep
my data.

If anybody can send me this file: which is located in
c:\windows\system32\drivers\drvmcdb.sys

Please send it to [EMAIL PROTECTED], coz I couldn't use this account
from tomorrow

I will appreciate your BIG HELP so much! You are my life saver!

 
Regards,
 

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


need drvmcdb.sys

2005-11-13 Thread james HU
Anybody has this file in ..\system32\drivers\drvmcdb.sys in your computer? please send it to me. You will save my life!  thanks a lot!     James
		 Yahoo! FareChase - Search multiple travel sites in one click.

 

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

wxImage can't read tif file? (WxPython)

2005-09-05 Thread James Hu
Hi, all gurus,

I am working on a small project, which needs to display 16 bit tiff image on
screen directly, I use wxStaticBitmap to do that, and I can show png and jpg
file on the screen without any problem. (converting from tiff to png first
is not option though). However, when I try to read tiff file, nothing
there,(the program is running without error) of course, the tiff is OK, I
can open it with IrFanView. where output.tif is about 640K, a little larger
than output.png(450K), the document says wxImage can open tif!
OR is there other way to show 16 bit tiff on windows with wxPython?
Another thing: how can I call the static methods like wxImage::FindHandler,
it always complains no matter what I use "image.FindHandler() or
wxImage.FindHandler()"

Any help will be apprecaited greatly!!!

James

the codes:

#image=wx.Image('output.png',wxBITMAP_TYPE_PNG)  #Can see,
image=wx.Image('output.tif',wxBITMAP_TYPE_TIF)   #can't see, still black as
the empty bitmap
bmp = image.ConvertToBitmap()
bmp.SetHeight(self.bmpHeight)
bmp.SetWidth(self.bmpWidth)
self.staticBitmap1.SetBitmap(bmp)   #staticBitmap1 already defined/created
before


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