473,666 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Image capture

Hi,
Can anybody help me to implement the following VB code in Python. Thanks in
advance.

Private Declare Function SendMessage Lib "user32.dll " Alias _
"SendMessag eA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long

Private Const WM_PAINT = &HF
Private Const WM_PRINT = &H317
Private Const PRF_CLIENT = &H4&
Private Const PRF_CHILDREN = &H10&
Private Const PRF_OWNED = &H20&

Private Sub Command1_Click( )
SendMessage grid.hwnd, WM_PAINT, picture.hDC, 0
SendMessage grid.hwnd, WM_PRINT, picture.hDC, PRF_CHILDREN Or PRF_CLIENT
Or PRF_OWNED
picture.Picture = picture.Image
picture.Refresh
End Sub
Catalin
lc******@siadv. com
Jul 18 '05 #1
3 3166
Catalin,

Some explanation about what you are tring to do will be of immense
help.

Did you want to capture some other Windows object from Python or do you
want to capture a Python GUI application from Python?

I might be able to help out, but please send more details.
Thank you,
--Kartic

Jul 18 '05 #2
Hi,

I want to capture a no visible area of a wxFrame of Python. This area
contain a wxGrid object. In VB6 this code work very good.

Thanks.

"Kartic" <ka************ ******@gmail.co m> escribió en el mensaje
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Catalin,

Some explanation about what you are tring to do will be of immense
help.

Did you want to capture some other Windows object from Python or do you
want to capture a Python GUI application from Python?

I might be able to help out, but please send more details.
Thank you,
--Kartic

Jul 18 '05 #3
Hi Catalin,

Here are the modifications to your code. I am emailing you the complete
file back to your email address. Please note that you need PIL (Python
Imaging Library) to grab the window. I included a step to save the
image, but you can do whatever you want with it.

Thanks,
--Kartic

-------------- Unified Diff ---------------

--- Catalin.txt Wed Jan 05 11:43:38 2005
+++ frmDesign.py Wed Jan 05 11:43:17 2005
@@ -1,7 +1,7 @@
from wxPython.wx import *
from wxPython.grid import *
from win32api import SendMessage
-import win32ui
+import win32ui, win32gui, ImageGrab

WM_PAINT = 0xf
WM_PRINT = 0x317
@@ -47,6 +47,10 @@
dc = wxMemoryDC()
dc.SelectObject (bmp)
dc.Clear()
+ win_sz = win32gui.GetWin dowRect(self.gr d.GetHandle())
+ print win_sz
+ im = ImageGrab.grab( (win_sz[0],win_sz[1],win_sz[2],win_sz[3]))
+ im.save('C:/TEMP/grid.jpg')
SendMessage(sel f.grd.GetHandle (), WM_PAINT, dc.GetHDC(), 0)
SendMessage(sel f.grd.GetHandle (), WM_PRINT, dc.GetHDC(),
PRF_CHILDREN|PR F_CLIENT|PRF_OW NED)

Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1870
by: Jeremy | last post by:
I've magnified an image on the form as following codes: private void ViewForm_Paint(object sender,System.Windows.Forms.PaintEventArgs e) { Point ulCorner = new Point( 0, 0); e.Graphics.DrawImage(theImage,ulCorner); } private void menuZoomIn_Click(object sender, System.EventArgs e)
2
8791
by: Paul Aspinall | last post by:
Hi I am trying to find some code, or reference docs, to assist in helping capture images from an image capture device (ie. webcam etc etc). I want to be able to compare successive images coming from the device, and be able to detect if the image has changed from the previous one. I have found some Java code which does something similar to what I want to do, but I am unsure which classes in the .Net framework are equivalents or of use in...
6
2942
by: anonymous | last post by:
hi all, I'm trying to use the capCreateCaptureWindow (see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_capcreatecapturewindow.asp) in a Windows Application Project. I want to pass Image as one of the parameter but I figure that an Image doesn't have a handle. Previously I had it working in a Web Application Project using the handle of a PictureBox. Is there any workaround? Please help and...
4
2449
by: Tomasz Bak | last post by:
Hello, I have a simple problem: mark a list of defects on an image. I think the best way to do it is to select a single deffect, then take two coordinates of coursor form an image on a web page (first when user press the button, and the second when he releases it). Those two points are going to be send to the web application (i.e. with AJAX) and saved in a database.
2
14530
by: | last post by:
Hi, we are planning to rewrite an extisting C++ image processing application/library in C#. Now several question arouse where I hope you can help me: So far we allocated a block of memory as image buffer, handed this to a driver dll and got raw image data back in this buffer. We then handed this buffer by reference to another C++ dll to do base image processing on it. Alternativly we copy an area of the whole image to a newly...
2
3219
by: ghostrider | last post by:
Hi, I am working on an access app and need to capture still images from a monitor connected to medical equipment. The video out port on the monitor is connected to a video card in the computer that will run my app so I am assuming I can capture this image by using video for windows apis? I simply want a button on a form that saves the image to disk in bmp or jpg format. Has anyone got an example of this? Thanks in advance, Ghostrider.
0
3409
by: indhu | last post by:
Hi all, am new to the VB forum. Anyway, i need a help from u all. i am developing project.where i am using some kind of webcam. capture image thru webcam by cliking capture button in the form. i ve to pick a color from the image using color picker tool. then this tool will drop the color in the next image (predefined image)other side of the form. then i will choose the lip area alone to change color using some predefined colors. any...
0
1625
by: =?Utf-8?B?Q2hha3JhdmFydGh5?= | last post by:
Hi, Have been trying to capture the webpage as image from quite a long time. Can some one suggest me a solution to convert or capture the HTML Output of any webresponse to anykind of image format. Have tried using the WebBrowser control to create a Bitmap object. WebBrowser control has "DrawToBitmap" method, which can help us to save the webpage to image format. But it is working with only http protocol, but not with HTTPS protocol.
0
1507
by: ikramalikhan | last post by:
i am developing a software in vb 6.0 as front end and msaccess as back end..i want to capture an ultrasound image via my vb form image control.my doctor client will capture live ultrasound image and save it ti ms word file. my form should show a live telecast of ultrasound machine images while the patient is underging scanning.Then a operator will capture a perticular image,and press button capture.The still image should be saved in ms word...
2
2805
by: raylopez99 | last post by:
Beware newbies: I spent a day before I figured this out: copying a bitmap (image) file to file is not quite like copying a text file--you have to do some tricks (see below), like using a "Graphics" object to wrap around the image (!). It's not so simple as shown in most examples (where they have a simple image file and hard copy it into a harddrive along the lines of : image.Save(@"C:\\temp\\myimage.pgn"); That will work, but it's a...
0
8448
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8783
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8640
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.