473,746 Members | 2,577 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Image capture

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

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
picture.Picture = picture.Image
End Sub
lc******@siadv. com
Jul 18 '05 #1
3 3169

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

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,

Jul 18 '05 #2

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.


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

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

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,

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.


-------------- 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)
+ 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(),

Jul 18 '05 #4

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

Similar topics

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)
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...
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...
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.
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...
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.
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...
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.
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...
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...
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...
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,...
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...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
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...
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...
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();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.