python - DearPyGui:主窗口始终位于顶部
问题描述
使用dearpygui,我希望主窗口(包含所有其他窗口的窗口)始终位于顶部,即使它没有焦点。这是我到目前为止所拥有的:
from dearpygui.core import *
from dearpygui.simple import *
with window('MainWindow', width=500, height=500):
add_button('Read screen')
解决方案
我现在选择了这个解决方案。如果图书馆支持,我会编辑我的答案。这是他们目前路线图中的一个功能(请参阅本期)。
from multiprocessing import Process
from time import sleep
import win32con
import win32gui
from dearpygui.core import *
from dearpygui.simple import *
with window('MainWindow', width=500, height=500):
add_button('Read screen')
if __name__ == '__main__':
# you have to make a new process for this in order to be able
# to call win32gui.FindWindow on your displayed window
p = Process(target=start_dearpygui)
p.start()
# sleep for a while to let your window get displayed
sleep(4)
hwnd = win32gui.FindWindow('DearPyGui', None)
win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 100, 100, 300, 200, 0)
推荐阅读
- java - 为什么 @Required 被 Spring 忽略?
- python - 使用列表理解修改字典列表
- c# - 从 Windows 窗体将值插入 SQL 数据库时出现不正确的语法错误
- wordpress - 如何将隐私政策页面与接受复选框上的标签文本链接?
- reactjs - 使用 AWS Cognito 对用户进行身份验证时出现网络错误
- java - 带有 Jersey 测试和 JAX-RS 的 Mockito - UnsatisfiedDependencyException
- php - 串流 MP3:iOS 2 分钟后重启 HTML5 音频
- docker - Docker:容器内的“网络无法访问”
- java - 用图像作为问题和答案做一个简单的测验
- javascript - 如何正确获取光标坐标?JavaScript