-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
希望能为“最大化”按钮的功能单独封装一下 #56
Comments
|
有空我研究一下,到时候我会提个 PR,你有空看看我有没有提 PR 就行,到时候审查一下。 主要是这个功能对于完全自定义标题栏十分重要,用户不一定想要此项目自定义的标题栏,因为他们可能不是用 tkinter 开发,可能是 QT 或者别的,那么单独分离该功能将成为该项目的亮点之一。 |
实际上,我想改良这个方法
这实际上也是我#54想做的(github copliot给的人机代码,运行都运行不了,脑子一热写上去了) |
如果可以,你可以在该 Issue 下提供一些可能有用资料的链接,我有空也可以尝试改良一下。:) |
其实就这个函数: from ctypes import windll
def call_snaplayout() -> None:
# 模拟按下 win + z
windll.user32.keybd_event(91, 0, 0, 0)
windll.user32.keybd_event(90, 0, 0, 0)
# 松开
windll.user32.keybd_event(91, 0, 2, 0)
windll.user32.keybd_event(90, 0, 2, 0) 这个方法也有弊端,输入法会被静止,窗口也会失去焦点,实际上正常方式调用的就不会有这个问题。 |
之前看到了这个地方,说实话我也觉得这个方法不太好,只能凑合用 |
是这样的,我也是这么想的 🤣 |
另外,说个题外话,关于你的 你可以看一下你的包被我的 Actions 下载了多少遍(因为测试失败重新安装环境导致的😂):https://pepy.tech/projects/win32material?timeRange=threeMonths&category=version&includeCIDownloads=true&granularity=daily&viewType=chart&versions=1.0.6%2C1.0.5%2C1.0.4 真的非常感谢!!! |
好的,也就是说我再去把版本更新上传到pypi上就可以了对吧 |
对的,非常感谢! |
上传了就没问题了,其它不用管 |
def WndProc(hwnd: Any, msg: Any, wp: Any, lp: Any) -> Any:
"""Handle the messages"""
if msg == WM_NCCALCSIZE and wp:
lpncsp = NCCALCSIZE_PARAMS.from_address(lp)
lpncsp.rgrc[0].top += TITLEBAR_REDUCE
lpncsp.rgrc[0].left += 8
lpncsp.rgrc[0].right -= 8
lpncsp.rgrc[0].bottom -= (0 if self.fullscreen else 8)
return 0
if msg == WM_NCHITTEST:
return 9 |
貌似只能在边框处理这个信息 |
研究了一下,确实没有比较好的办法 |
也并不是没有吧,可能处理一下这个事件会比手动触发的要好 |
此项目的“最大化”按钮在鼠标移至上面悬停时,可以触发 Windows11 的一个与分屏有关的功能,希望能为其单独封装,便于第三方调用。:)
The text was updated successfully, but these errors were encountered: