【问题标题】:DearPyGui: Main window always on topDearPyGui:主窗口始终位于顶部
【发布时间】:2021-01-30 16:15:27
【问题描述】:

使用dearpygui,我希望主窗口(包含所有其他窗口的窗口)始终位于顶部,即使它没有焦点。 这是我到目前为止所拥有的:

from dearpygui.core import *
from dearpygui.simple import *


with window('MainWindow', width=500, height=500):
    add_button('Read screen')

【问题讨论】:

    标签: python dearpygui


    【解决方案1】:

    我现在选择了这个解决方案。如果图书馆支持,我将编辑我的答案。这是他们目前路线图中的一项功能 (see this issue)。

    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)
    

    【讨论】:

      猜你喜欢
      • 2011-08-23
      • 2018-05-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多