LAVEL 发表于 2022-12-22 20:06:05

"win32lib is not defined"运行错误求助

import os
import time
#import easyutils
import win32api
from ctypes import *
import win32con
import win32gui
from email.header import Header
from email.mime.text import MIMEText
from smtplib import SMTP_SSL
import requests
import datetime

..............

win32gui.PostMessage(win32lib.FindWindow(classname, titlename), win32con.WM_CLOSE, 0, 0)
win32api包也已安装,但在运行过程中出现
将win32lib换为win32gui也可以运行,但在网上没看到这个写法
win32gui.PostMessage(win32gui.FindWindow(classname, titlename), win32con.WM_CLOSE, 0, 0)
求助如何处理该问题???

Traceback (most recent call last):
File "D:/Users/lavel/PycharmProjects/untitled/ABC.py", line 72, in <module>
    get_current_sizeB()
File "D:/Users/lavel/PycharmProjects/untitled/ABC.py", line 57, in get_current_sizeB
    win32gui.PostMessage(win32lib.FindWindow(classname, titlename), win32con.WM_CLOSE, 0, 0)
NameError: name 'win32lib' is not defined

hrpzcf 发表于 2022-12-22 21:24:34

本帖最后由 hrpzcf 于 2022-12-22 21:25 编辑

win32gui、win32api等模块是pywin32包里的模块,但win32lib好像没见过,是不是win32api?先安装pywin32包看看
页: [1]
查看完整版本: "win32lib is not defined"运行错误求助