Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use the win32gui module with Python?

Im my Python file, I have imported the win32gui module like this:

import win32gui

I have also downloaded win32gui but don't know how to make my script run. How can I run my Python script which imports win32gui? When I run it, I get:

ImportError: No module named win32gui

Sorry for the newbie question but I'm trying to learn Python so don't know much about it.

like image 538
Harry Joy Avatar asked Jul 08 '11 12:07

Harry Joy


People also ask

How do I use win32gui in Python?

pip install pywin32==300Then import win32gui will work with python 3.8. Show activity on this post. PyCharm can be configured to work in an isolated python environment. To be sure to install it for the project environment, follow this document from PyCharm editor.

What is win32gui in Python?

A module which provides an interface to the native win32 GUI API. Note that a module winxpgui also exists, which has the same methods as win32gui, but has an XP manifest and is setup for side-by-side sharing support for certain system DLLs, notably commctl32.

Does win32gui work on Linux?

You can't. They are Python interfaces for Windows functions. Linux does not have these functions. You can perhaps run python in wine, but ymmv.


2 Answers

When on a windows platform, I usually go for the executables. They should work all the time. Try perhaps one of the files listed here:

http://sourceforge.net/projects/pywin32/files/pywin32/Build216/

It's the most recent build. Choose the one appropriate to your Python's version.

like image 120
Senthess Avatar answered Oct 28 '22 11:10

Senthess


this is a module from Marc Hammond's well-known pywin32 extension module, you can also get the source and compile it quite easily (I found I needed to do this because I needed a 64 bit build and couldn't find one at the time). The mercurial address to get it is:

http://pywin32.hg.sourceforge.net:8000/hgroot/pywin32/pywin32

there are visual studio project files in the .\pywin32\win32 directory...

like image 31
brett bazant Avatar answered Oct 28 '22 10:10

brett bazant