pywin32

Python Flask as Windows Service

≡放荡痞女 提交于 2021-02-05 18:57:59
问题 I am trying to get a Flask app to run as a Service in Windows. I have already tried to implement a solution as suggested here and here without success. I have a simple folder with just two files: Project | +-- myapp.py +-- win32_service.py Inside myapp.py is a simple Flask app: from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello, World!' And the service skeleton win32_service.py : import win32serviceutil import win32service import win32event import

Python Flask as Windows Service

泪湿孤枕 提交于 2021-02-05 18:55:16
问题 I am trying to get a Flask app to run as a Service in Windows. I have already tried to implement a solution as suggested here and here without success. I have a simple folder with just two files: Project | +-- myapp.py +-- win32_service.py Inside myapp.py is a simple Flask app: from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello, World!' And the service skeleton win32_service.py : import win32serviceutil import win32service import win32event import

Python Flask as Windows Service

限于喜欢 提交于 2021-02-05 18:54:25
问题 I am trying to get a Flask app to run as a Service in Windows. I have already tried to implement a solution as suggested here and here without success. I have a simple folder with just two files: Project | +-- myapp.py +-- win32_service.py Inside myapp.py is a simple Flask app: from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello, World!' And the service skeleton win32_service.py : import win32serviceutil import win32service import win32event import

Global hotkey on windows with tkinter

為{幸葍}努か 提交于 2021-02-04 21:11:39
问题 I want a python tkinter application to register a global hotkey (triggered even if the application has not the focus). I've found some pieces, but I can't find a way to put them together... Basically, I can register the hotkey (with a call to the windows API RegisterHotKey), but it send a "WM_HOTKEY" message to the root windows that is under Tkinter mainloop management, and I cant find a way to bind on it... tk.protocol() function seems to be there for it, but this message seems not to be

Moving Worsksheet after a Named Worksheet in Excel using pywin32 Dispatch

喜夏-厌秋 提交于 2021-02-04 21:06:49
问题 I have tons of files where I need to copy a certain sheet from them to another workbook, they need to be placed after a sheet with a specific name, while keeping all the formatting in the sheet that is being moved. I saw in another thread that pywin32 would be the way to go, however I am having a hard time with copying this sheet "After" the named sheet. xl = Dispatch("Excel.Application") xl.Visible = True xl.AskToUpdateLinks = False xl.EnableEvents = False xl.DisplayAlerts = False wb1 = xl

ModuleNotFoundError: No module named 'win32crypt'

ε祈祈猫儿з 提交于 2021-01-29 12:34:59
问题 I'm trying to run a Python module for a school project and I am getting this error ModuleNotFoundError: No module named 'win32crypt' at line import win32crypt . I've search the website for solution and encountered a post that states pywin32 is required. So I installed it with pip. I also tried installing pypiwin32. None of these installs worked. Now I've tried Dependency Walker to see if there are any dependencies missing and I see at least 100 DLLs that are. How can I fix the issue? 回答1:

Problems while taking screenshots of a window and displaying it with OpenCV

别说谁变了你拦得住时间么 提交于 2021-01-28 20:10:52
问题 When i run this code on my desktop pc it runs fine. but when i run it op my laptop something goes wrong when i set the bounding box for the image grab to the bounding box of the windows calculator and the screen recording of the window and places it self a little up and to the left. import cv2 import numpy as np from PIL import ImageGrab import win32gui def windowGrab(window_title=None): if window_title: global hwnd hwnd = win32gui.FindWindow(None, window_title) if hwnd: win32gui

pywin32: how do I get a pyDEVMODE object?

喜你入骨 提交于 2021-01-28 14:07:09
问题 How can I create a PyDEVMODE object without just having it as a return from a function call like win32api.EnumDisplaySettingsEx(name, 0) ? 回答1: It's defined in pywintypes. >>> import pywintypes >>> pywintypes.DEVMODEType() <PyDEVMODE object at 0x00F38E90> I'm curious as to what you are going to use it for? 来源: https://stackoverflow.com/questions/3857884/pywin32-how-do-i-get-a-pydevmode-object

Pystray icon available when running as a service

孤街醉人 提交于 2021-01-28 11:10:04
问题 Using: Python (3.7.5) Pyinstaller (3.5) Pywin32 (223) Pystray (Current) I have a python program that uses Pystray to show an icon which allows me to make Tkinter window available. It took a while but, thanks to stack overflow, this functionality works fine. I then create an executable for this using PyInstaller and this also runs fine. Up to here everything is great, executing the program starts its webservice and shows the icon. I call this program from a service created with pywin32. The

How to know if a window is maximized using pywin32?

不打扰是莪最后的温柔 提交于 2021-01-28 11:09:17
问题 I need to check if a window is maximized using pywin32. I'm on a windows 10 machine. I have looked through the documentation but can't find a straight solution, any leads? 回答1: Use GetWindowPlacement API. In pywin32, win32gui.GetWindowPlacement will return a tuple which can be tested as follows: window = win32gui.FindWindow("Notepad", None) if window: tup = win32gui.GetWindowPlacement(window) if tup[1] == win32con.SW_SHOWMAXIMIZED: print("maximized") elif tup[1] == win32con.SW_SHOWMINIMIZED: